crzerolog
crzerolog copied to clipboard
handler breaks zerolog.ConsoleWriter
hi,
for local development, we setup the zerolog logger with a ConsoleWriter.
However, since the crzerolog handler is removing the "level" field, replacing? it with "severity", the console writer cannot see the log level producing output such as
1:51PM ??? call the starters count=0
1:51PM ??? services are ready for business
maybe the Console write should respect zerolog.LevelFieldName
my workaround is to override the FormalLevel as the crzerolog pkg changes the labels for the levels.
cons := zerolog.ConsoleWriter{Out: os.Stderr}
cons.FormatLevel = func(i interface{}) string {
if s, ok := i.(string); ok {
return s
}
return "<?>"
}
Thanks @ernest-ag5. This package renames the level value and that causes ???
in zerolog ConsoleWriter logic.
I filed a PR in zerolog to fix this issue: https://github.com/rs/zerolog/pull/476
For the time being, please use the workaround you mentioned.
This issue was fixed in https://github.com/yfuruyama/crzerolog/pull/4, please use the latest version of this package.
please create a new tag so I can update my deps
@ernest-ag5 Tagged: https://github.com/yfuruyama/crzerolog/releases/tag/v0.3.1
Thanks!