Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: add struct for recording errors #3113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ziutech
Copy link

@ziutech ziutech commented Oct 20, 2024

Implements tracing_core::field::{error,ErrorValue} as part of #3067.

@@ -270,6 +273,12 @@ pub struct DisplayValue<T: fmt::Display>(T);
#[derive(Clone)]
pub struct DebugValue<T: fmt::Debug>(T);

/// A 'Value' which serializes error and it's sources.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A 'Value' which serializes error and it's sources.
/// A `Value` which serializes error and its sources.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I'm not sure we should talk about sources here. What will be recorded is subscriber-specific, it can completely ignore the sources.

@@ -658,6 +678,20 @@ impl<T: fmt::Debug> fmt::Debug for DebugValue<T> {
}
}

// ===== impl ErrorValue =====
#[cfg(feature = "std")]
impl<T: error::Error + 'static> crate::sealed::Sealed for ErrorValue<'_, T> {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it enought for T to outlive 'a?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants