Fix pretty logging and add a screenshot to the README
This commit is contained in:
parent
90fdb63d84
commit
2ed2f2c974
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
1
log.go
1
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
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 377 KiB |
Loading…
Reference in New Issue