Skip to content

Commit

Permalink
Merge pull request #659 from drmingdrmer/50-panic
Browse files Browse the repository at this point in the history
Improve: panic hook for integration test should print error message to stderr, not only record it in log file
  • Loading branch information
mergify[bot] committed Feb 10, 2023
2 parents 2112ee3 + 49b1c1f commit e31b0f9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions openraft/tests/fixtures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ pub fn log_panic(panic: &PanicInfo) {
}
};

eprintln!("{}", panic);

if let Some(location) = panic.location() {
tracing::error!(
message = %panic,
Expand All @@ -124,9 +126,12 @@ pub fn log_panic(panic: &PanicInfo) {
panic.line = location.line(),
panic.column = location.column(),
);
eprintln!("{}:{}:{}", location.file(), location.line(), location.column());
} else {
tracing::error!(message = %panic, backtrace = %backtrace);
}

eprintln!("{}", backtrace);
}

/// A type which emulates a network transport and implements the `RaftNetworkFactory` trait.
Expand Down

0 comments on commit e31b0f9

Please sign in to comment.