Browse Source

Adds API for interrogating current mode

It returns one of the following values:
- gin.	DebugMode
- gin.	ReleaseMode
- gin.	TestMode
Manu Mtz-Almeida 11 years ago
parent
commit
fd2e342569
1 changed files with 6 additions and 0 deletions
  1. 6 0
      mode.go

+ 6 - 0
mode.go

@@ -22,6 +22,7 @@ const (
 )
 
 var gin_mode int = debugCode
+var mode_name string = DebugMode
 
 func SetMode(value string) {
 	switch value {
@@ -34,6 +35,11 @@ func SetMode(value string) {
 	default:
 		panic("gin mode unknown, the allowed modes are: " + DebugMode + " and " + ReleaseMode)
 	}
+	mode_name = value
+}
+
+func Mode() string {
+	return mode_name
 }
 
 func init() {