mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-23 01:20:11 +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:
parent
abc51f2443
commit
151062fbc1
8
main.go
8
main.go
@ -82,7 +82,6 @@ func setGinLogger(router *gin.Engine, debugMode bool) {
|
|||||||
}(),
|
}(),
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
gin.SetMode(gin.DebugMode)
|
|
||||||
} else {
|
} else {
|
||||||
router.Use(gin.LoggerWithFormatter(func(param gin.LogFormatterParams) string {
|
router.Use(gin.LoggerWithFormatter(func(param gin.LogFormatterParams) string {
|
||||||
return fmt.Sprintf("[GIN] %s(%s) => %d\n",
|
return fmt.Sprintf("[GIN] %s(%s) => %d\n",
|
||||||
@ -91,7 +90,6 @@ func setGinLogger(router *gin.Engine, debugMode bool) {
|
|||||||
param.StatusCode,
|
param.StatusCode,
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
gin.SetMode(gin.ReleaseMode)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,11 +284,15 @@ func main() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debugMode = false
|
debugMode = false
|
||||||
gin.SetMode(gin.ReleaseMode)
|
|
||||||
address = "0.0.0.0:8056"
|
address = "0.0.0.0:8056"
|
||||||
}
|
}
|
||||||
|
|
||||||
app.info.Println("Loading routes")
|
app.info.Println("Loading routes")
|
||||||
|
if debugMode {
|
||||||
|
gin.SetMode(gin.DebugMode)
|
||||||
|
} else {
|
||||||
|
gin.SetMode(gin.ReleaseMode)
|
||||||
|
}
|
||||||
router := gin.New()
|
router := gin.New()
|
||||||
|
|
||||||
setGinLogger(router, debugMode)
|
setGinLogger(router, debugMode)
|
||||||
|
Loading…
Reference in New Issue
Block a user