Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default console formatter use same color for field and value on Err #366

Closed
asger-noer opened this issue Sep 28, 2021 · 0 comments
Closed

Comments

@asger-noer
Copy link
Contributor

This is not anything critical and totally a quality of life fix, but the output of the ConsoleWriter when writing following code snippet will not color the error field name with the same color as all the other field names.

log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})

if err := SomeFunc(); err != nil {
  log.Info().Err(err).Msg("log message")
}

Function in question

zerolog/console.go

Lines 399 to 403 in 07d347e

func consoleDefaultFormatErrFieldName(noColor bool) Formatter {
return func(i interface{}) string {
return colorize(fmt.Sprintf("%s=", i), colorRed, noColor)
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant