3 stable releases
Uses old Rust 2015
2.1.3 | Aug 11, 2023 |
---|---|
2.1.2 | Aug 9, 2023 |
#856 in Debugging
22 downloads per month
10KB
102 lines
rust-log-panics
this is a fork from rust-log-panics the difference is that this crate will als print to terminal, the reason is without this, rust integration test will not failure reason.
A panic hook which logs panics rather than printing them.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
lib.rs
:
this is a fork of log-panic, we are just keeping the writing to standard error functionality. Without it, when rust integration test failed, you can't see any failure reason printed on the terminal.
A crate which logs panics as erro using log
crate as well as writing to standard error.
The format used is identical to the standard library's.
Because logging with a backtrace requires additional dependencies,
the with-backtrace
feature must be enabled. You can add the
following in your Cargo.toml
:
log-print-panics = { version = "2", features = ["with-backtrace"]}
To use, call log_print_panics::init()
somewhere early in execution,
such as immediately after initializing log
, or use the Config
builder for more customization.
Dependencies
~0–5MB
~12K SLoC