eyre icon indicating copy to clipboard operation
eyre copied to clipboard

Print a backtrace/spantrace to debug logs but not to stderr

Open gibfahn opened this issue 5 months ago • 1 comments

(migrated from https://github.com/eyre-rs/color-eyre/issues/130)

Sorry if this is in the docs/examples and I missed it, but I'm struggling to work out how I would manually generate a backtrace or a spantrace from a color_eyre::Result.

The use-case is a user-facing CLI, where I write trace logs to a file. When something goes wrong printing a backtrace tends to confuse users, and makes them even more likely to miss the Suggestion: I added that tells them exactly what to do 😁

However the backtrace is useful for me, when I didn't add enough context to each layer of the error stack to see where the error propagated.

The CLI tells people to ask for support and attach the log file in the issue, and so I'd like to tracing::debug!() log the spantrace so it persists in the log file.

gibfahn avatar Sep 16 '24 11:09 gibfahn