Struct tracing_tree::HierarchicalLayer

source ·
pub struct HierarchicalLayer<W = fn() -> Stderr, FT = ()>
where W: for<'writer> MakeWriter<'writer> + 'static, FT: FormatTime,
{ /* private fields */ }

Implementations§

source§

impl HierarchicalLayer<fn() -> Stderr>

source

pub fn new(indent_amount: usize) -> Self

source§

impl<W, FT> HierarchicalLayer<W, FT>
where W: for<'writer> MakeWriter<'writer> + 'static, FT: FormatTime,

source

pub fn with_ansi(self, ansi: bool) -> Self

Enables terminal colors, boldness and italics.

source

pub fn with_writer<W2>(self, make_writer: W2) -> HierarchicalLayer<W2, FT>
where W2: for<'writer> MakeWriter<'writer>,

source

pub fn with_indent_amount(self, indent_amount: usize) -> Self

source

pub fn with_indent_lines(self, indent_lines: bool) -> Self

Renders an ascii art tree instead of just using whitespace indentation.

source

pub fn with_timer<FT2: FormatTime>( self, timer: FT2, ) -> HierarchicalLayer<W, FT2>

Specifies how to measure and format time at which event has occurred.

source

pub fn with_targets(self, targets: bool) -> Self

Whether to render the event and span targets. Usually targets are the module path to the event/span macro invocation.

source

pub fn with_thread_ids(self, thread_ids: bool) -> Self

Whether to render the thread id in the beginning of every line. This is helpful to untangle the tracing statements emitted by each thread.

source

pub fn with_thread_names(self, thread_names: bool) -> Self

Whether to render the thread name in the beginning of every line. Not all threads have names, but if they do, this may be more helpful than the generic thread ids.

source

pub fn with_wraparound(self, wraparound: usize) -> Self

Resets the indentation to zero after wraparound indentation levels. This is helpful if you expect very deeply nested spans as otherwise the indentation just runs out of your screen.

source

pub fn with_verbose_entry(self, verbose_entry: bool) -> Self

Whether to print the currently active span’s message again before entering a new span. This helps if the entry to the current span was quite a while back (and with scrolling upwards in logs).

source

pub fn with_verbose_exit(self, verbose_exit: bool) -> Self

Whether to print the currently active span’s message again before dropping it. This helps if the entry to the current span was quite a while back (and with scrolling upwards in logs).

source

pub fn with_span_retrace(self, enabled: bool) -> Self

Whether to print the currently active span’s message again if another span was entered in the meantime This helps during concurrent or multi-threaded events where threads are entered, but not necessarily exited before other divergent spans are entered and generating events.

source

pub fn with_deferred_spans(self, enabled: bool) -> Self

Defers printing span opening until an event is generated within the span.

Avoids printing empty spans with no generated events.

source

pub fn with_span_modes(self, enabled: bool) -> Self

Prefixes each branch with the event mode, such as open, or close

source

pub fn with_bracketed_fields(self, bracketed_fields: bool) -> Self

Whether to print {} around the fields when printing a span. This can help visually distinguish fields from the rest of the message.

Trait Implementations§

source§

impl<W, FT> Debug for HierarchicalLayer<W, FT>
where W: for<'writer> MakeWriter<'writer> + 'static + Debug, FT: FormatTime + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for HierarchicalLayer

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<S, W, FT> Layer<S> for HierarchicalLayer<W, FT>
where S: Subscriber + for<'span> LookupSpan<'span>, W: for<'writer> MakeWriter<'writer> + 'static, FT: FormatTime + 'static,

source§

fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)

Notifies this layer that a new span was constructed with the given Attributes and Id.
source§

fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>)

Notifies this layer that an event has occurred.
source§

fn on_close(&self, id: Id, ctx: Context<'_, S>)

Notifies this layer that the span with the given ID has been closed.
source§

fn on_register_dispatch(&self, collector: &Dispatch)

Performs late initialization when installing this layer as a Subscriber. Read more
source§

fn on_layer(&mut self, subscriber: &mut S)

Performs late initialization when attaching a Layer to a Subscriber. Read more
source§

fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest

Registers a new callsite with this layer, returning whether or not the layer is interested in being notified about the callsite, similarly to Subscriber::register_callsite. Read more
source§

fn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool

Returns true if this layer is interested in a span or event with the given metadata in the current Context, similarly to Subscriber::enabled. Read more
source§

fn on_record(&self, _span: &Id, _values: &Record<'_>, _ctx: Context<'_, S>)

Notifies this layer that a span with the given Id recorded the given values.
source§

fn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<'_, S>)

Notifies this layer that a span with the ID span recorded that it follows from the span with the ID follows.
source§

fn event_enabled(&self, _event: &Event<'_>, _ctx: Context<'_, S>) -> bool

Called before on_event, to determine if on_event should be called. Read more
source§

fn on_enter(&self, _id: &Id, _ctx: Context<'_, S>)

Notifies this layer that a span with the given ID was entered.
source§

fn on_exit(&self, _id: &Id, _ctx: Context<'_, S>)

Notifies this layer that the span with the given ID was exited.
source§

fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)

Notifies this layer that a span ID has been cloned, and that the subscriber returned a different ID.
source§

fn and_then<L>(self, layer: L) -> Layered<L, Self, S>
where L: Layer<S>, Self: Sized,

Composes this layer around the given Layer, returning a Layered struct implementing Layer. Read more
source§

fn with_subscriber(self, inner: S) -> Layered<Self, S>
where Self: Sized,

Composes this Layer with the given Subscriber, returning a Layered struct that implements Subscriber. Read more
source§

fn with_filter<F>(self, filter: F) -> Filtered<Self, F, S>
where Self: Sized, F: Filter<S>,

Combines self with a Filter, returning a Filtered layer. Read more

Auto Trait Implementations§

§

impl<W = fn() -> Stderr, FT = ()> !Freeze for HierarchicalLayer<W, FT>

§

impl<W, FT> RefUnwindSafe for HierarchicalLayer<W, FT>

§

impl<W, FT> Send for HierarchicalLayer<W, FT>
where W: Send, FT: Send,

§

impl<W, FT> Sync for HierarchicalLayer<W, FT>
where W: Sync, FT: Sync,

§

impl<W, FT> Unpin for HierarchicalLayer<W, FT>
where W: Unpin, FT: Unpin,

§

impl<W, FT> UnwindSafe for HierarchicalLayer<W, FT>
where W: UnwindSafe, FT: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.