From: phiresky Date: Fri, 30 Jun 2023 13:32:43 +0000 (+0200) Subject: don't strip, log trace if requested (#3425) X-Git-Url: http://these/git/%22%7Burl%7D/%7B%60%24%7BghostArchiveUrl%7D/%7B%60/feeds/inbox/%7BmarkdownHelpUrl%7D?a=commitdiff_plain;h=cb28af508d030683561bdc9dde2299cf818f2c6b;p=lemmy.git don't strip, log trace if requested (#3425) --- diff --git a/Cargo.lock b/Cargo.lock index 1fb6746e..ba527f0a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -399,6 +399,9 @@ name = "anyhow" version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +dependencies = [ + "backtrace", +] [[package]] name = "argparse" @@ -2590,6 +2593,7 @@ dependencies = [ "tokio", "tracing", "uuid", + "wav", ] [[package]] @@ -4445,6 +4449,12 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "riff" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9b1a3d5f46d53f4a3478e2be4a5a5ce5108ea58b100dcd139830eae7f79a3a1" + [[package]] name = "ring" version = "0.16.20" @@ -6256,6 +6266,15 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wav" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a65e199c799848b4f997072aa4d673c034f80f40191f97fe2f0a23f410be1609" +dependencies = [ + "riff", +] + [[package]] name = "web-sys" version = "0.3.60" diff --git a/Cargo.toml b/Cargo.toml index 6fbd91d1..e7ab7709 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,14 +21,9 @@ repository.workspace = true doctest = false [profile.release] -strip = "symbols" debug = 0 lto = "thin" -[profile.dev] -strip = "symbols" -debug = 0 - [features] embed-pictrs = ["pict-rs"] console = ["console-subscriber", "opentelemetry", "opentelemetry-otlp", "tracing-opentelemetry", "reqwest-tracing/opentelemetry_0_16"] @@ -85,7 +80,7 @@ base64 = "0.13.1" uuid = { version = "1.3.4", features = ["serde", "v4"] } async-trait = "0.1.68" captcha = "0.0.9" -anyhow = "1.0.71" +anyhow = { version = "1.0.71", features = ["backtrace"] } # backtrace is on by default on nightly, but not stable rust diesel_ltree = "0.3.0" typed-builder = "0.10.0" serial_test = "0.9.0" diff --git a/crates/utils/src/error.rs b/crates/utils/src/error.rs index 1aa3e1c6..c89e84db 100644 --- a/crates/utils/src/error.rs +++ b/crates/utils/src/error.rs @@ -90,7 +90,11 @@ impl Display for LemmyError { if let Some(message) = &self.message { write!(f, "{message}: ")?; } - writeln!(f, "{}", self.inner)?; + // print anyhow including trace + // https://docs.rs/anyhow/latest/anyhow/struct.Error.html#display-representations + // this will print the anyhow trace (only if it exists) + // and if RUST_BACKTRACE=1, also a full backtrace + writeln!(f, "{:?}", self.inner)?; fmt::Display::fmt(&self.context, f) } }