Skip to content

Commit f95c264

Browse files
Output backtrace to tracing (#1393)
Without a backtrace it is very difficult to analyse errors and the logs are not always easily accessible Change: tracing-bt
1 parent 7bc2eec commit f95c264

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

josh-core/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ where
155155
T: std::error::Error,
156156
{
157157
fn from(item: T) -> Self {
158-
tracing::event!(tracing::Level::ERROR, item = ?item, error = true);
159-
log::error!("JoshError: {:?}", item);
160158
let bt = backtrace::Backtrace::new();
159+
tracing::event!(tracing::Level::ERROR, item = ?item, backtrace = format!("{:?}", bt), error = true);
160+
log::error!("JoshError: {:?}", item);
161161
log::error!("Backtrace: {:?}", bt);
162162
josh_error(&format!("converted {:?}", item))
163163
}

0 commit comments

Comments
 (0)