We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I want to be able to export the stack to a JSON file but not to the console (ConsoleWriter).
ConsoleWriter initialization:
consoleWriter := zerolog.NewConsoleWriter() consoleWriter.TimeFormat = "02/01/2006 15:04:05.000" consoleWriter.PartsExclude = []string{zerolog.CallerFieldName, zerolog.ErrorStackFieldName}
Call:
err := errors.New("a test error") log.Error().Stack().Err(err).Send()
With this:
consoleWriter.PartsExclude = []string{}
Output:
11/11/2021 10:15:18.000 ERR ***/main.go:36 > error="a test error" stack=[{"func":"main","line":"35","source":"main.go"},{"func":"main","line":"225","source":"proc.go"},{"func":"goexit","line":"841","source":"asm_arm.s"}]
And with excluded parts:
consoleWriter.PartsExclude = []string{zerolog.CallerFieldName, zerolog.ErrorStackFieldName}
Output: (The caller is not here, but the stack is)
11/11/2021 10:15:18.000 ERR error="a test error" stack=[{"func":"main","line":"35","source":"main.go"},{"func":"main","line":"225","source":"proc.go"},{"func":"goexit","line":"841","source":"asm_arm.s"}]
Expected output:
11/11/2021 10:15:18.000 ERR error="a test error"
The text was updated successfully, but these errors were encountered:
Stack trace is a field, while caller is a part. You want #411.
Sorry, something went wrong.
No branches or pull requests
I want to be able to export the stack to a JSON file but not to the console (ConsoleWriter).
ConsoleWriter initialization:
Call:
With this:
Output:
And with excluded parts:
Output: (The caller is not here, but the stack is)
Expected output:
The text was updated successfully, but these errors were encountered: