- log
- simple_logger
Simple Logger new
examples/logging/simple_logger_new/Cargo.toml
[package] name = "simple_logger_new" version = "0.1.0" edition = "2021" [dependencies] log = "0.4.22" simple_logger = "5.0.0"
examples/logging/simple_logger_new/src/main.rs
fn main() { simple_logger::SimpleLogger::new().init().unwrap(); log::trace!("This is a sample trace."); log::debug!("This is a sample debug."); log::info!("This is a sample info."); log::warn!("This is a sample warn."); log::error!("This is a sample error."); }
2024-08-04T12:13:57.055Z TRACE [simple_logger_new] This is a sample trace. 2024-08-04T12:13:57.055Z DEBUG [simple_logger_new] This is a sample debug. 2024-08-04T12:13:57.055Z INFO [simple_logger_new] This is a sample info. 2024-08-04T12:13:57.055Z WARN [simple_logger_new] This is a sample warn. 2024-08-04T12:13:57.055Z ERROR [simple_logger_new] This is a sample error.