pub struct BreadcrumbLayer { /* private fields */ }Expand description
A tracing layer that records every event it sees as a breadcrumb.
Cheap by construction: events below min_level are
rejected before their fields are visited, and a recorded crumb costs one
bounded-ring push. Recording is a no-op until crate::init runs, so
installing the layer early is harmless.
Implementations§
Source§impl BreadcrumbLayer
impl BreadcrumbLayer
Sourcepub fn min_level(self, level: TracingLevel) -> Self
pub fn min_level(self, level: TracingLevel) -> Self
Record events at level and above. Lowering this to DEBUG or TRACE
buys a denser trail at the cost of evicting older crumbs sooner — the
ring is bounded, so verbosity trades depth for reach.
Sourcepub fn only_targets<I, S>(self, targets: I) -> Self
pub fn only_targets<I, S>(self, targets: I) -> Self
Record only events whose target starts with one of these prefixes, e.g.
["myapp", "myapp_storage"]. Empty (the default) accepts every target.
Worth setting in a binary with chatty dependencies: a bounded ring full of HTTP client logs has crowded out the storage operations that explain the corruption.
Trait Implementations§
Source§impl Default for BreadcrumbLayer
impl Default for BreadcrumbLayer
Source§impl<S> Layer<S> for BreadcrumbLayerwhere
S: Subscriber + for<'a> LookupSpan<'a>,
impl<S> Layer<S> for BreadcrumbLayerwhere
S: Subscriber + for<'a> LookupSpan<'a>,
Source§fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>)
fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>)
Source§fn on_register_dispatch(&self, subscriber: &Dispatch)
fn on_register_dispatch(&self, subscriber: &Dispatch)
Subscriber. Read moreSource§fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
Subscriber::register_callsite. Read moreSource§fn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool
fn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool
true if this layer is interested in a span or event with the
given metadata in the current Context, similarly to
Subscriber::enabled. Read moreSource§fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
Attributes and Id.Source§fn on_record(&self, _span: &Id, _values: &Record<'_>, _ctx: Context<'_, S>)
fn on_record(&self, _span: &Id, _values: &Record<'_>, _ctx: Context<'_, S>)
Id recorded the given
values.Source§fn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<'_, S>)
fn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<'_, S>)
span recorded that it
follows from the span with the ID follows.Source§fn on_enter(&self, _id: &Id, _ctx: Context<'_, S>)
fn on_enter(&self, _id: &Id, _ctx: Context<'_, S>)
Source§fn on_exit(&self, _id: &Id, _ctx: Context<'_, S>)
fn on_exit(&self, _id: &Id, _ctx: Context<'_, S>)
Source§fn on_close(&self, _id: Id, _ctx: Context<'_, S>)
fn on_close(&self, _id: Id, _ctx: Context<'_, S>)
Source§fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
Source§fn and_then<L>(self, layer: L) -> Layered<L, Self, S>
fn and_then<L>(self, layer: L) -> Layered<L, Self, S>
Layer, returning a Layered
struct implementing Layer. Read moreSource§fn with_subscriber(self, inner: S) -> Layered<Self, S>where
Self: Sized,
fn with_subscriber(self, inner: S) -> Layered<Self, S>where
Self: Sized,
Layer with the given Subscriber, returning a
Layered struct that implements Subscriber. Read more