Crate simple_logger
source ·Expand description
A logger that prints all messages with a simple, readable output format.
Optional features include timestamps, colored output and logging to stderr.
simple_logger::SimpleLogger::new().env().init().unwrap();
log::warn!("This is an example message.");Some shortcuts are available for common use cases.
Just initialize logging without any configuration:
simple_logger::init().unwrap();Set the log level from the RUST_LOG environment variable:
simple_logger::init_with_env().unwrap();Hardcode a default log level:
simple_logger::init_with_level(log::Level::Warn).unwrap();Structs
- Implements
Logand a set of simple builder methods for configuration.
Functions
- Initialise the logger with its default configuration.
- init_by_envDeprecatedUse
init_with_envinstead. - Initialise the logger with its default configuration.
- Initialise the logger with the
RUST_LOGenvironment variable. - Initialise the logger with a specific log level.