[−][src]Struct simple_logger::SimpleLogger
Implementations
impl SimpleLogger
[src]
#[must_use = "You must call init() to begin logging"]pub fn new() -> SimpleLogger
[src]
Initializes the global logger with a SimpleLogger instance with
default log level set to Level::Trace
.
You may use the various builder-style methods on this type to configure
the logger, and you must call init
in order to start logging messages.
use simple_logger::SimpleLogger; SimpleLogger::new().init(); log::warn!("This is an example message.");
#[must_use = "You must call init() to begin logging"]pub fn from_env() -> SimpleLogger
[src]
A macro for simulating env_logger behavior, which enables the user to choose log level by
setting a RUST_LOG
environment variable. The RUST_LOG
is not set or its value is not
recognized as one of the log levels, this function with use the Error
level by default.
You may use the various builder-style methods on this type to configure
the logger, and you must call init
in order to start logging messages.
use simple_logger::SimpleLogger; SimpleLogger::from_env().init(); log::warn!("This is an example message.");
#[must_use = "You must call init() to begin logging"]pub fn with_level(self, level: LevelFilter) -> SimpleLogger
[src]
Set the 'default' log level.
#[must_use = "You must call init() to begin logging"]pub fn with_module_level(self, target: &str, level: LevelFilter) -> SimpleLogger
[src]
Override the log level for specific module.
Examples
Change log level for specific crate:
use simple_logger::SimpleLogger; use log::LevelFilter; SimpleLogger::new().with_module_level("something", LevelFilter::Warn).init();
Disable logging for specific crate:
use simple_logger::SimpleLogger; use log::LevelFilter; SimpleLogger::new().with_module_level("something", LevelFilter::Off).init();
#[must_use = "You must call init() to begin logging"]pub fn with_target_levels(
self,
target_levels: HashMap<String, LevelFilter>
) -> SimpleLogger
[src]
self,
target_levels: HashMap<String, LevelFilter>
) -> SimpleLogger
Override the log level for specific targets.
pub fn init(self) -> Result<(), SetLoggerError>
[src]
'Init' the actual logger, instantiate it and configure it, this method MUST be called in order for the logger to be effective.
Trait Implementations
impl Default for SimpleLogger
[src]
impl Log for SimpleLogger
[src]
Auto Trait Implementations
impl RefUnwindSafe for SimpleLogger
impl Send for SimpleLogger
impl Sync for SimpleLogger
impl Unpin for SimpleLogger
impl UnwindSafe for SimpleLogger
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,