1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 17:10:10 +00:00

set gin mode before router initialization

this was previously set after the router was created, causing a debug
message every start.
This commit is contained in:
Harvey Tindall 2020-08-17 12:33:26 +01:00
parent abc51f2443
commit 151062fbc1
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2

View File

@ -82,7 +82,6 @@ func setGinLogger(router *gin.Engine, debugMode bool) {
}(),
)
}))
gin.SetMode(gin.DebugMode)
} else {
router.Use(gin.LoggerWithFormatter(func(param gin.LogFormatterParams) string {
return fmt.Sprintf("[GIN] %s(%s) => %d\n",
@ -91,7 +90,6 @@ func setGinLogger(router *gin.Engine, debugMode bool) {
param.StatusCode,
)
}))
gin.SetMode(gin.ReleaseMode)
}
}
@ -286,11 +284,15 @@ func main() {
}
} else {
debugMode = false
gin.SetMode(gin.ReleaseMode)
address = "0.0.0.0:8056"
}
app.info.Println("Loading routes")
if debugMode {
gin.SetMode(gin.DebugMode)
} else {
gin.SetMode(gin.ReleaseMode)
}
router := gin.New()
setGinLogger(router, debugMode)