Skip to main content

init_with_env

Function init_with_env 

Source
pub fn init_with_env() -> Result<(), SetLoggerError>
Expand description

Initialise the logger with the RUST_LOG environment variable.

Log messages will be filtered based on the RUST_LOG environment variable.

This will use the default level (LevelFilter::Trace) if the RUST_LOG environment variable is not set or can’t be parsed as a standard log level (see LevelFilter::from_str and [log::LOG_LEVEL_NAMES] for valid names).

Examples found in repository?
examples/init_with_env.rs (line 17)
16fn main() {
17    simple_logger::init_with_env().unwrap();
18
19    log::trace!("This is an example message.");
20    log::debug!("This is an example message.");
21    log::info!("This is an example message.");
22    log::warn!("This is an example message.");
23    log::error!("This is an example message.");
24}