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

Wrong usage of log.Err() method #80

Open
DmytroLinkin opened this issue Jul 29, 2020 · 2 comments
Open

Wrong usage of log.Err() method #80

DmytroLinkin opened this issue Jul 29, 2020 · 2 comments
Labels
refactoring Code refactoring

Comments

@DmytroLinkin
Copy link
Contributor

From source:

// Err starts a new message with error level with err as a field if not nil or
// with info level if err is nil.
//
// You must call Msg on the returned event in order to send the event.
func Err(err error) *zerolog.Event {
        return Logger.Err(err)
}

To get desired logging every log.Err(err) line should be changed to log.Error().Msgf("%v", err)

@adrianchiris
Copy link
Collaborator

alternatively:
log.Err(err).Msg("")
or
log.Err(err).Send()

@DmytroLinkin
Copy link
Contributor Author

log.Err(err).Msg("")

This form produce line with some "technical" noise, something like:
ERR "error": some text describing error

@adrianchiris adrianchiris added the refactoring Code refactoring label Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Code refactoring
Projects
None yet
Development

No branches or pull requests

2 participants