I though about that in my projects that are using logrus,
I use to write the stack trace to important logs.
The way I do that now is:
logger.WithField("stack", string(debug.Stack())
but that is not a nice way of doing that, because I need to choose a key for that any time I want to add the stack trace to a log entry. I think it would be nice to add a function WithStack(), like WithError()
Some error reporting systems, such as GCP Error Reporting, use the existence of a stack to decide whether a log entry is an error. Currently we have to do:
logger.WithError(err).Error("This is an error\n", string(debug.Stack()))
Which is a bit cumbersome.
I've added a small pull request because I think it would be a nice to have feature.
Closing per the project being put into maintenance mode
Most helpful comment
I've added a small pull request because I think it would be a nice to have feature.