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

handler breaks zerolog.ConsoleWriter #3

Closed
ernest-ag5 opened this issue Sep 7, 2022 · 6 comments
Closed

handler breaks zerolog.ConsoleWriter #3

ernest-ag5 opened this issue Sep 7, 2022 · 6 comments

Comments

@ernest-ag5
Copy link

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
@ernest-ag5
Copy link
Author

maybe the Console write should respect zerolog.LevelFieldName

@ernest-ag5
Copy link
Author

ernest-ag5 commented Sep 9, 2022

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 "<?>"
}

@yfuruyama
Copy link
Owner

yfuruyama commented Sep 11, 2022

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: rs/zerolog#476

For the time being, please use the workaround you mentioned.

@yfuruyama
Copy link
Owner

This issue was fixed in #4, please use the latest version of this package.

@ernest-ag5
Copy link
Author

please create a new tag so I can update my deps

@yfuruyama
Copy link
Owner

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

2 participants