diff --git a/debug.go b/debug.go index 449291e6..b97e2abb 100644 --- a/debug.go +++ b/debug.go @@ -8,11 +8,10 @@ import ( "bytes" "html/template" "log" + "os" ) -func init() { - log.SetFlags(0) -} +var debugLog = log.New(os.Stderr, "[GIN-debug] ", 0) // IsDebugging returns true if the framework is running in debug mode. // Use SetMode(gin.Release) to disable debug mode. @@ -42,7 +41,7 @@ func debugPrintLoadTemplate(tmpl *template.Template) { func debugPrint(format string, values ...interface{}) { if IsDebugging() { - log.Printf("[GIN-debug] "+format, values...) + debugLog.Printf(format, values...) } } diff --git a/debug_test.go b/debug_test.go index dfd54c82..accdd33d 100644 --- a/debug_test.go +++ b/debug_test.go @@ -9,7 +9,6 @@ import ( "errors" "html/template" "io" - "log" "os" "testing" @@ -106,10 +105,10 @@ func TestDebugPrintWARNINGNew(t *testing.T) { func setup(w io.Writer) { SetMode(DebugMode) - log.SetOutput(w) + debugLog.SetOutput(w) } func teardown() { SetMode(TestMode) - log.SetOutput(os.Stdout) + debugLog.SetOutput(os.Stderr) }