Skip to content

Commit

Permalink
Output backtrace to tracing (#1393)
Browse files Browse the repository at this point in the history
Without a backtrace it is very difficult to analyse errors and
the logs are not always easily accessible

Change: tracing-bt
  • Loading branch information
christian-schilling authored Sep 25, 2024
1 parent 7bc2eec commit f95c264
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions josh-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ where
T: std::error::Error,
{
fn from(item: T) -> Self {
tracing::event!(tracing::Level::ERROR, item = ?item, error = true);
log::error!("JoshError: {:?}", item);
let bt = backtrace::Backtrace::new();
tracing::event!(tracing::Level::ERROR, item = ?item, backtrace = format!("{:?}", bt), error = true);
log::error!("JoshError: {:?}", item);
log::error!("Backtrace: {:?}", bt);
josh_error(&format!("converted {:?}", item))
}
Expand Down

0 comments on commit f95c264

Please sign in to comment.