Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Log Panics
◌ CI pending Fintan Halpenny committed 7 months ago
commit 4e047d1c8b64d806bee6dd041a65e751963ad032
parent 5fea9ac05c7296dce3f8dec363b7442bec929c55
1 pending (1 total) View logs
3 files changed +14 -8
modified Cargo.lock
@@ -2107,6 +2107,16 @@ dependencies = [
]

[[package]]
+
name = "log-panics"
+
version = "2.1.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "68f9dd8546191c1850ecf67d22f5ff00a935b890d0e84713159a55495cc2ac5f"
+
dependencies = [
+
 "backtrace",
+
 "log",
+
]
+

+
[[package]]
name = "matchers"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2920,6 +2930,7 @@ dependencies = [
 "libc",
 "localtime",
 "log",
+
 "log-panics",
 "netservices",
 "nonempty 0.9.0",
 "qcheck",
modified crates/radicle-node/Cargo.toml
@@ -27,6 +27,7 @@ io-reactor = { version = "0.5.1", features = ["popol"] }
lexopt = { workspace = true }
libc = { workspace = true }
log = { workspace = true, features = ["std"] }
+
log-panics = { version = "2", features = ["with-backtrace"] }
localtime = { workspace = true }
netservices = { version = "0.8.0", features = ["io-reactor", "socket2"] }
nonempty = { workspace = true, features = ["serialize"] }
modified crates/radicle-node/src/main.rs
@@ -301,14 +301,6 @@ fn initialize_logging(options: &LogOptions) -> Result<(), Box<dyn std::error::Er
}

fn main() {
-
    // If `RUST_BACKTRACE` does not have a value, then we set it to capture
-
    // backtraces for better debugging, otherwise we keep the environments
-
    // value.
-
    const RUST_BACKTRACE: &str = "RUST_BACKTRACE";
-
    if std::env::var_os(RUST_BACKTRACE).is_none() {
-
        std::env::set_var(RUST_BACKTRACE, "1");
-
    }
-

    let options = parse_options().unwrap_or_else(|err| {
        // The lexopt errors read nicely with a comma.
        eprintln!("Failed to parse options, {err:#}");
@@ -320,6 +312,8 @@ fn main() {
        exit(3);
    });

+
    log_panics::init();
+

    if let Err(err) = execute(options) {
        log::error!(target: "node", "{err:#}");
        exit(1);