1use log::*;
2use sp_log::*;
3
4use std::fs::File;
5
6fn main() {
7 CombinedLogger::init(vec![
8 #[cfg(feature = "termcolor")]
9 TermLogger::new(
10 LevelFilter::Warn,
11 Config::default(),
12 TerminalMode::Mixed,
13 ColorChoice::Auto,
14 ),
15 #[cfg(not(feature = "termcolor"))]
16 SimpleLogger::new(LevelFilter::Warn, Config::default()),
17 WriteLogger::new(
18 LevelFilter::Info,
19 Config::default(),
20 File::create("my_rust_binary.log").unwrap(),
21 ),
22 ])
23 .unwrap();
24
25 error!("Bright red error");
26 info!("This only appears in the log file");
27 debug!("This level is currently not enabled for any logger");
28}