println!("Start") // Start printlnt!("Start"); // [231209_14:00:00] Start
How could I make a macro like the above?
You can define a macro as below
macro_rules! printlnt { ($($arg:tt)*) => { println!("[{}] {}", chrono::Local::now().format("%y%m%d_%H:%M:%S"), $($arg)*); }; }
Copyright © 2021 Jogjafile Inc.
You can define a macro as below