diff --git a/README.md b/README.md index 9a401cc..8013d82 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ The uber's [zap](https://godoc.org/go.uber.org/zap) library pioneered this appro To keep the code base and the API simple, zerolog focuses on JSON logging only. Pretty logging on the console is made possible using the provided `zerolog.ConsoleWriter`. +![](pretty.png) + ## Features * Blazing fast diff --git a/console.go b/console.go index 5b194d6..ca15045 100644 --- a/console.go +++ b/console.go @@ -95,7 +95,7 @@ func colorize(s interface{}, color int, enabled bool) string { func levelColor(level string) int { switch level { case "debug": - return cGray + return cMagenta case "info": return cGreen case "warn": @@ -109,7 +109,7 @@ func levelColor(level string) int { func needsQuote(s string) bool { for i := range s { - if s[i] < 0x20 || s[i] > 0x7e || s[i] == '\\' || s[i] == '"' { + if s[i] < 0x20 || s[i] > 0x7e || s[i] == ' ' || s[i] == '\\' || s[i] == '"' { return true } } diff --git a/log.go b/log.go index e3c590f..acd3824 100644 --- a/log.go +++ b/log.go @@ -167,6 +167,7 @@ func (l Logger) Output(w io.Writer) Logger { l2 := New(w) l2.level = l.level l2.sample = l.sample + l2.context = make([]byte, len(l.context)) copy(l2.context, l.context) return l2 } diff --git a/pretty.png b/pretty.png new file mode 100644 index 0000000..c181164 Binary files /dev/null and b/pretty.png differ