Open abagshaw opened 3 years ago
There are two things I do normally.
zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack
cause := errors.WithStack(v)
log.Error().Stack().Err(cause).Msg("uhoh")
Usually gets me what I want. The stack traces this way aren't as "robust" as you'd normally get but they're great for logging.
Any way to get a nicely formatted stack trace like we do with
log.Err(err).Stack().Msg("uh oh")
from a panic?After recovering from a panic I'm wanting to log the stack trace and the only way I can do that right now is with
debug.Stack()
which gives the stack trace as one big block of text. Is there any way to get the stack trace from a panic in a format that zerolog can recognize?