From 2ab51bb36071e4db7059f65deb2a981740f87656 Mon Sep 17 00:00:00 2001 From: Carl Jackson Date: Thu, 24 Jul 2014 17:56:49 -0700 Subject: [PATCH] Only add log.Lmicroseconds if log.Ltime is set Also, move it out of Serve so it's possible to override. --- goji.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/goji.go b/goji.go index 5f2d61c..f6d9335 100644 --- a/goji.go +++ b/goji.go @@ -46,6 +46,9 @@ import ( func init() { bind.WithFlag() + if fl := log.Flags(); fl&log.Ltime != 0 { + log.SetFlags(fl | log.Lmicroseconds) + } } // Serve starts Goji using reasonable defaults. @@ -54,8 +57,6 @@ func Serve() { flag.Parse() } - log.SetFlags(log.Flags() | log.Lmicroseconds) - // Install our handler at the root of the standard net/http default mux. // This allows packages like expvar to continue working as expected. http.Handle("/", DefaultMux)