Struct structured_logger::Logger
source · pub struct Logger { /* private fields */ }
Expand description
Logger is a struct that holds the configuration for the logger.
Implementations§
source§impl Logger
impl Logger
sourcepub fn with_level(level: LevelFilter) -> Self
pub fn with_level(level: LevelFilter) -> Self
with_level creates a new Logger with a given level filter.
sourcepub fn with_target_writer(
self,
target: &'static str,
writer: Box<dyn Writer>
) -> Self
pub fn with_target_writer( self, target: &'static str, writer: Box<dyn Writer> ) -> Self
with_target_writer creates a new Logger with a given target and writer.
sourcepub fn init(self)
pub fn init(self)
initialize the logger.
See the crate level documentation for more.
Panics
This will panic if the logger fails to initialize. Use Logger::try_init
if
you want to handle the error yourself.
sourcepub fn try_init(self) -> Result<(), SetLoggerError>
pub fn try_init(self) -> Result<(), SetLoggerError>
Try to initialize the logger.
Unlike Logger::init
this doesn’t panic when the logger fails to initialize.
See the crate level documentation for more.