Logger

Trait Logger 

Source
pub trait Logger: LoggerConfig {
    // Provided method
    fn log_init(
        self,
        layers: Option<Vec<Box<dyn Layer<Registry> + Send + Sync + 'static>>>,
    ) -> Result<Self> { ... }
}
Expand description

blanket implementation for automatic tracing & tracing_subscriber initialization

Refer to LoggerConfig for configuration options.

Provided Methods§

Source

fn log_init( self, layers: Option<Vec<Box<dyn Layer<Registry> + Send + Sync + 'static>>>, ) -> Result<Self>

register the supplied layers with the global tracing subscriber

Default behvaior is to automatically (on startup) register the layer provided by LoggerConfig::default_log_layer.

This automatic setup/config can be disabled with LoggerConfig::bypass_log_init. When bypassed, Logger::log_init must be manually/directly called from the application. This is an advanced use case. Refer to LoggerConfig::bypass_log_init for more details.

§Errors

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§