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§
- Simple
Logger - Implements
Log
and a set of simple builder methods for configuration.
Functions§
- init
- Initialise the logger with its default configuration.
- init_
by_ env Deprecated - Use
init_with_env
instead. - init_
utc - Initialise the logger with its default configuration.
- init_
with_ env - Initialise the logger with the
RUST_LOG
environment variable. - init_
with_ level - Initialise the logger with a specific log level.