1 use std::{fs::File, io}; 2 3 use log::LevelFilter; 4 use simplelog::{CombinedLogger, WriteLogger}; 5 6 pub struct Log; 7 8 impl Log { 9 pub fn init(level: LevelFilter) -> io::Result<()> { 10 CombinedLogger::init(vec![ 11 // TermLogger::new( 12 // level.to_simplelog_filter(), 13 // simplelog::Config::default(), 14 // simplelog::TerminalMode::default(), 15 // simplelog::ColorChoice::Auto, 16 // ), 17 WriteLogger::new( 18 level, 19 simplelog::Config::default(), 20 File::create("held.log")?, 21 ), 22 ]) 23 .unwrap(); 24 25 Ok(()) 26 } 27 } 28