nocolor log fmt
Juan Batiz-Benet committed
Oct 26, 2014 at 01:44 UTC
54c2a14c10afe2b68ead7058d260119de70ad3f8
1 file changed
+3
-2
util/log.go
+3
-2
@@ -18,10 +18,11 @@ var ansiBlue = "\033[0;34m"
18
19
// LogFormats is a map of formats used for our logger, keyed by name.
20
var LogFormats = map[string]string{
21
- "default": "%{color}%{time:2006-01-02 15:04:05.000000} %{level} %{module} %{shortfile}: %{color:reset}%{message}",
21
+ "nocolor": "%{time:2006-01-02 15:04:05.000000} %{level} %{module} %{shortfile}: %{message}",
22
"color": ansiGray + "%{time:15:04:05.000} %{color}%{level:5.5s} " + ansiBlue +
23
"%{module:10.10s}: %{color:reset}%{message} " + ansiGray + "%{shortfile}%{color:reset}",
24
}
25
+var defaultLogFormat = "color"
26
27
// Logging environment variables
28
const (
@@ -42,7 +43,7 @@ func SetupLogging() {
43
44
fmt := LogFormats[os.Getenv(envLoggingFmt)]
45
if fmt == "" {
45
- fmt = LogFormats["default"]
46
+ fmt = LogFormats[defaultLogFormat]
47
}
48
49
backend := logging.NewLogBackend(os.Stderr, "", 0)