26 lines
584 B
Rust
26 lines
584 B
Rust
#[macro_use] extern crate log;
|
|
|
|
use log::warn;
|
|
|
|
fn main() {
|
|
fern::Dispatch::new()
|
|
.format(|out, message, record| {
|
|
out.finish(format_args!(
|
|
"{}[{}][{}] {}",
|
|
chrono::Local::now().format("[%Y-%m-%d][%H:%M:%S]"),
|
|
record.target(),
|
|
record.level(),
|
|
message
|
|
))
|
|
})
|
|
.level(log::LevelFilter::Debug)
|
|
// .level_for(module, level)
|
|
.chain(std::io::stdout())
|
|
.apply().unwrap();
|
|
|
|
debug!("Hello, world!");
|
|
info!("Hello, world!");
|
|
warn!("Hello, world!");
|
|
error!("Hello, world!");
|
|
}
|