don't strip, log trace if requested (#3425)

This commit is contained in:
phiresky 2023-06-30 15:32:43 +02:00 committed by GitHub
parent 810762762f
commit cb28af508d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 7 deletions

19
Cargo.lock generated
View File

@ -399,6 +399,9 @@ name = "anyhow"
version = "1.0.71" version = "1.0.71"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
dependencies = [
"backtrace",
]
[[package]] [[package]]
name = "argparse" name = "argparse"
@ -2590,6 +2593,7 @@ dependencies = [
"tokio", "tokio",
"tracing", "tracing",
"uuid", "uuid",
"wav",
] ]
[[package]] [[package]]
@ -4445,6 +4449,12 @@ dependencies = [
"bytemuck", "bytemuck",
] ]
[[package]]
name = "riff"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9b1a3d5f46d53f4a3478e2be4a5a5ce5108ea58b100dcd139830eae7f79a3a1"
[[package]] [[package]]
name = "ring" name = "ring"
version = "0.16.20" version = "0.16.20"
@ -6256,6 +6266,15 @@ dependencies = [
"web-sys", "web-sys",
] ]
[[package]]
name = "wav"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a65e199c799848b4f997072aa4d673c034f80f40191f97fe2f0a23f410be1609"
dependencies = [
"riff",
]
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.60" version = "0.3.60"

View File

@ -21,14 +21,9 @@ repository.workspace = true
doctest = false doctest = false
[profile.release] [profile.release]
strip = "symbols"
debug = 0 debug = 0
lto = "thin" lto = "thin"
[profile.dev]
strip = "symbols"
debug = 0
[features] [features]
embed-pictrs = ["pict-rs"] embed-pictrs = ["pict-rs"]
console = ["console-subscriber", "opentelemetry", "opentelemetry-otlp", "tracing-opentelemetry", "reqwest-tracing/opentelemetry_0_16"] 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"] } uuid = { version = "1.3.4", features = ["serde", "v4"] }
async-trait = "0.1.68" async-trait = "0.1.68"
captcha = "0.0.9" 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" diesel_ltree = "0.3.0"
typed-builder = "0.10.0" typed-builder = "0.10.0"
serial_test = "0.9.0" serial_test = "0.9.0"

View File

@ -90,7 +90,11 @@ impl Display for LemmyError {
if let Some(message) = &self.message { if let Some(message) = &self.message {
write!(f, "{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) fmt::Display::fmt(&self.context, f)
} }
} }