Feature request: snafu::report_log
Basically, something like snafu::report, but that uses log for output, possibly a configurable level (as not all Errors are errors).
As a next step, implementing log::kv::ToValue on snafu::Report so we get the values structured would be amazing. I'm aware of #407, so this needs further discussion on details.
Given an arbitrary impl std::error::Error, what would you expect snafu::report_log to do / output?
That... is a good question. My main intent here was for snafu::report_log to specifically output contents similar to snafu::report. For consistency's sake, I'd say that it should behave similarly to snafu::report, which seems to convert the impl std::error::Error to snafu::Raport and output that.
My original intent was for this to be output from within a controlled library crate - as a shim to work together with tracing::instrument without introducing new dependencies or trait implementations.
I now realize that, without the log::kv::ToValue support for some form of structured logging, this wouldn't make much sense. Can't really stuff the nice chain display you have into regular, single-line, logs.
I now realize that, without the
log::kv::ToValuesupport for some form of structured logging, this wouldn't make much sense. Can't really stuff the nice chain display you have into regular, single-line, logs.
I think this is getting towards my point. Can you provide any kind of example of an error and what the corresponding log output would be? If you need it, use tracing_subscriber::fmt::fmt as a concrete subscriber.
I only realized I haven't replied to this issue because I'm cleaning up my GH notifications. Given that, and that I'm not really using snafu, closing this issue.