Refactors warning messages

This commit is contained in:
Manu Mtz-Almeida
2015-06-26 16:08:55 +02:00
parent 9268afb15d
commit 4cc2de6207
2 changed files with 13 additions and 8 deletions

View File

@ -27,7 +27,7 @@ func debugPrint(format string, values ...interface{}) {
}
}
func debugPrintWARNING() {
func debugPrintWARNING_New() {
debugPrint(`[WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
@ -35,6 +35,16 @@ func debugPrintWARNING() {
`)
}
func debugPrintWARNING_SetHTMLTemplate() {
debugPrint(`[WARNING] Since SetHTMLTemplate() is NOT thread-safe. It should only be called
at initialization. ie. before any route is registered or the router is listening in a socket:
router := gin.Default()
router.SetHTMLTemplate(template) // << good place
`)
}
func debugPrintError(err error) {
if err != nil {
debugPrint("[ERROR] %v\n", err)