pub struct TracingFieldBuilder { /* private fields */ }Expand description
Builder for TracingField metadata.
Implementations§
Source§impl TracingFieldBuilder
impl TracingFieldBuilder
Sourcepub fn span_field(self, name: &'static str) -> Self
pub fn span_field(self, name: &'static str) -> Self
Set the span field name to extract from.
If not set, the context key (from registration) is used as the span field name.
Sourcepub fn extract_from_str<T>(
self,
f: impl Fn(&str) -> Option<T> + Send + Sync + 'static,
) -> Self
pub fn extract_from_str<T>( self, f: impl Fn(&str) -> Option<T> + Send + Sync + 'static, ) -> Self
Extract from string span field values.
The closure receives the string value and returns Some(T) if
conversion succeeds. set_context is called automatically.
Sourcepub fn extract_from_u64<T>(
self,
f: impl Fn(u64) -> Option<T> + Send + Sync + 'static,
) -> Self
pub fn extract_from_u64<T>( self, f: impl Fn(u64) -> Option<T> + Send + Sync + 'static, ) -> Self
Extract from u64 span field values.
Sourcepub fn extract_from_i64<T>(
self,
f: impl Fn(i64) -> Option<T> + Send + Sync + 'static,
) -> Self
pub fn extract_from_i64<T>( self, f: impl Fn(i64) -> Option<T> + Send + Sync + 'static, ) -> Self
Extract from i64 span field values.
Sourcepub fn extract_from_bool<T>(
self,
f: impl Fn(bool) -> Option<T> + Send + Sync + 'static,
) -> Self
pub fn extract_from_bool<T>( self, f: impl Fn(bool) -> Option<T> + Send + Sync + 'static, ) -> Self
Extract from bool span field values.
Sourcepub fn enrich_display<T: Display + 'static>(self) -> Self
pub fn enrich_display<T: Display + 'static>(self) -> Self
Enrich log output using Display.
Sourcepub fn enrich_debug<T: Debug + 'static>(self) -> Self
pub fn enrich_debug<T: Debug + 'static>(self) -> Self
Enrich log output using Debug.
Sourcepub fn enrich_custom<T: 'static>(
self,
f: impl Fn(&T) -> String + Send + Sync + 'static,
) -> Self
pub fn enrich_custom<T: 'static>( self, f: impl Fn(&T) -> String + Send + Sync + 'static, ) -> Self
Enrich log output with a custom formatting function.
Sourcepub fn build(self) -> TracingField
pub fn build(self) -> TracingField
Build the TracingField metadata.
Auto Trait Implementations§
impl Freeze for TracingFieldBuilder
impl !RefUnwindSafe for TracingFieldBuilder
impl Send for TracingFieldBuilder
impl Sync for TracingFieldBuilder
impl Unpin for TracingFieldBuilder
impl UnsafeUnpin for TracingFieldBuilder
impl !UnwindSafe for TracingFieldBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more