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

9
gin.go
View File

@ -83,7 +83,7 @@ var _ RoutesInterface = &Engine{}
// Returns a new blank Engine instance without any middleware attached.
// The most basic configuration
func New() *Engine {
debugPrintWARNING()
debugPrintWARNING_New()
engine := &Engine{
RouterGroup: RouterGroup{
Handlers: nil,
@ -134,12 +134,7 @@ func (engine *Engine) LoadHTMLFiles(files ...string) {
func (engine *Engine) SetHTMLTemplate(templ *template.Template) {
if len(engine.trees) > 0 {
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
`)
debugPrintWARNING_SetHTMLTemplate()
}
engine.HTMLRender = render.HTMLProduction{Template: templ}
}