Log panics when not attached to a pty

Hopefully this will give us better forensics if we panic in production.
This commit is contained in:
Nathan Sobo 2021-09-15 04:51:22 -06:00
parent 914112f2b5
commit 7d59b2d861
3 changed files with 13 additions and 0 deletions

11
Cargo.lock generated
View File

@ -2807,6 +2807,16 @@ dependencies = [
"value-bag",
]
[[package]]
name = "log-panics"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae0136257df209261daa18d6c16394757c63e032e27aafd8b07788b051082bef"
dependencies = [
"backtrace",
"log",
]
[[package]]
name = "loom"
version = "0.4.0"
@ -5910,6 +5920,7 @@ dependencies = [
"lazy_static",
"libc",
"log",
"log-panics",
"num_cpus",
"parking_lot",
"postage",

View File

@ -35,6 +35,7 @@ image = "0.23"
lazy_static = "1.4.0"
libc = "0.2"
log = "0.4"
log-panics = { version = "2.0", features = ["with-backtrace"] }
num_cpus = "1.13.0"
parking_lot = "0.11.1"
postage = { version = "0.4.1", features = ["futures-traits"] }

View File

@ -90,6 +90,7 @@ fn init_logger() {
.expect("could not open logfile");
simplelog::WriteLogger::init(level, simplelog::Config::default(), log_file)
.expect("could not initialize logger");
log_panics::init();
}
}