timestamps_format.rs 338 B

123456789101112
  1. use simple_logger::SimpleLogger;
  2. use time::macros::format_description;
  3. fn main() {
  4. SimpleLogger::new()
  5. .env()
  6. .with_timestamp_format(format_description!("[year]-[month]-[day] [hour]:[minute]:[second]"))
  7. .init()
  8. .unwrap();
  9. log::warn!("This is an example message with custom timestamp format.");
  10. }