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
ghost opened this issue Sep 7, 2022 · 6 comments
Closed

handler breaks zerolog.ConsoleWriter #3

ghost opened this issue Sep 7, 2022 · 6 comments

Comments

@ghost
Copy link

ghost commented Sep 7, 2022

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

ghost commented Sep 7, 2022

maybe the Console write should respect zerolog.LevelFieldName

@ghost
Copy link
Author

ghost 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.

@ghost
Copy link
Author

ghost commented Sep 19, 2022

please create a new tag so I can update my deps

@yfuruyama
Copy link
Owner

@ernest-ag5 Tagged: https://github.com/yfuruyama/crzerolog/releases/tag/v0.3.1

Thanks!

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