From 8b6d97fd4ad1a582dceb7c7fd457a4eedfb1bc01 Mon Sep 17 00:00:00 2001 From: "Aode (lion)" Date: Wed, 24 Nov 2021 21:57:20 -0600 Subject: [PATCH] Don't include SpanTrace in Error debug --- src/error.rs | 7 ++++++- src/main.rs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/error.rs b/src/error.rs index 6c3ee0c..ef6f73d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -9,12 +9,17 @@ use std::{convert::Infallible, fmt::Debug, io}; use tracing::error; use tracing_error::SpanTrace; -#[derive(Debug)] pub(crate) struct Error { context: SpanTrace, kind: ErrorKind, } +impl std::fmt::Debug for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + writeln!(f, "{:?}", self.kind) + } +} + impl std::fmt::Display for Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { writeln!(f, "{}", self.kind)?; diff --git a/src/main.rs b/src/main.rs index 9a76b27..506bee1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,7 +37,7 @@ fn init_subscriber( let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")); let format_layer = tracing_subscriber::fmt::layer() - .with_span_events(FmtSpan::NEW | FmtSpan::CLOSE) + .with_span_events(FmtSpan::CLOSE) .pretty(); let subscriber = tracing_subscriber::Registry::default()