feat: add fern
This commit is contained in:
25
__log/fern/src/main.rs
Normal file
25
__log/fern/src/main.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
#[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!");
|
||||
}
|
||||
Reference in New Issue
Block a user