pub struct LogMetadata<'a> {
pub level: Level,
pub level_filter: AtomicU32,
pub fmt_str: &'a str,
pub target: &'a str,
pub module_path: &'a str,
pub file: &'a str,
pub line: u32,
}Fields§
§level: Level§level_filter: AtomicU32§fmt_str: &'a str§target: &'a str§module_path: &'a str§file: &'a str§line: u32Implementations§
Source§impl LogMetadata<'_>
impl LogMetadata<'_>
Sourcepub fn level_filter(&self, generation: u16) -> FilterState
pub fn level_filter(&self, generation: u16) -> FilterState
This is a way to efficiency implement finer grade filtering by amortizing its cost. An atomic is used to store a level filter and a 16 bit generation. Allowing a config update to be applied to the level filter multiple times during the lifetime of the process.
ⓘ
const GENERATION: u16 = 1;
let level_filter = metadata.level_filter(GENERATION).unwrap_or_else(|| {
let level_filter = self.level_filter(metadata.target);
metadata.set_level_filter(level_filter, GENERATION);
level_filter
});
if metadata.level <= level_filter {
...
}Sourcepub fn set_level_filter(
&self,
generation: u16,
level_filter: Option<LevelFilter>,
)
pub fn set_level_filter( &self, generation: u16, level_filter: Option<LevelFilter>, )
Sets the level filter if the generation is greater than the current generation.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !Freeze for LogMetadata<'a>
impl<'a> RefUnwindSafe for LogMetadata<'a>
impl<'a> Send for LogMetadata<'a>
impl<'a> Sync for LogMetadata<'a>
impl<'a> Unpin for LogMetadata<'a>
impl<'a> UnwindSafe for LogMetadata<'a>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].