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§

SimpleLogger
Implements Log and a set of simple builder methods for configuration.

Functions§

init
Initialise the logger with its default configuration.
init_by_envDeprecated
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.