[−][src]Struct tracing_chrome::ChromeLayerBuilder
Implementations
impl<S> ChromeLayerBuilder<S> where
S: Subscriber + for<'span> LookupSpan<'span> + Send + Sync,
[src]
S: Subscriber + for<'span> LookupSpan<'span> + Send + Sync,
pub fn new() -> Self
[src]
pub fn file(self, file: String) -> Self
[src]
Set the file to which to output the trace.
Defaults to "./trace-{unix epoch time}.json"
pub fn include_args(self, include: bool) -> Self
[src]
Include arguments in each trace entry.
Defaults to false.
Includes the arguments used when creating a span/event in the "args" section of the trace entry.
pub fn include_locations(self, include: bool) -> Self
[src]
Include file+line with each trace entry.
Defaults to true.
This can add quite a bit of data to the output so turning it off might be helpful when collecting larger traces.
pub fn trace_style(self, style: TraceStyle) -> Self
[src]
Sets the style used when recording trace events.
See TraceStyle
for details.
pub fn name_fn(
self,
name_fn: Box<dyn Fn(&EventOrSpan<'_, '_, S>) -> String + Send + Sync>
) -> Self
[src]
self,
name_fn: Box<dyn Fn(&EventOrSpan<'_, '_, S>) -> String + Send + Sync>
) -> Self
Allows supplying a function that derives a name from an Event or Span. The result is used as the "name" field on trace entries.
Example
use tracing_chrome::{ChromeLayerBuilder, EventOrSpan}; use tracing_subscriber::{registry::Registry, prelude::*}; let (chrome_layer, _guard) = ChromeLayerBuilder::new().name_fn(Box::new(|event_or_span| { match event_or_span { EventOrSpan::Event(ev) => { ev.metadata().name().into() }, EventOrSpan::Span(_s) => { "span".into() }, } })).build(); tracing_subscriber::registry().with(chrome_layer).init()
pub fn category_fn(
self,
cat_fn: Box<dyn Fn(&EventOrSpan<'_, '_, S>) -> String + Send + Sync>
) -> Self
[src]
self,
cat_fn: Box<dyn Fn(&EventOrSpan<'_, '_, S>) -> String + Send + Sync>
) -> Self
Allows supplying a function that derives a category from an Event or Span. The result is used as the "cat" field on trace entries.
Example
use tracing_chrome::{ChromeLayerBuilder, EventOrSpan}; use tracing_subscriber::{registry::Registry, prelude::*}; let (chrome_layer, _guard) = ChromeLayerBuilder::new().category_fn(Box::new(|_| { "my_module".into() })).build(); tracing_subscriber::registry().with(chrome_layer).init()
pub fn build(self) -> (ChromeLayer<S>, FlushGuard)
[src]
Trait Implementations
impl<S: Default> Default for ChromeLayerBuilder<S> where
S: Subscriber + for<'span> LookupSpan<'span> + Send + Sync,
[src]
S: Subscriber + for<'span> LookupSpan<'span> + Send + Sync,
pub fn default() -> ChromeLayerBuilder<S>
[src]
Auto Trait Implementations
impl<S> !RefUnwindSafe for ChromeLayerBuilder<S>
impl<S> Send for ChromeLayerBuilder<S>
impl<S> Sync for ChromeLayerBuilder<S>
impl<S> Unpin for ChromeLayerBuilder<S> where
S: Unpin,
S: Unpin,
impl<S> !UnwindSafe for ChromeLayerBuilder<S>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,