extern crate logging; #[test] fn create() { let log1 = logging::get("main".to_owned()); let log2 = logging::get("main.logger".to_owned()); assert_eq!(log1.name(), String::from("main")); assert_eq!(log1.full_name(), String::from("main")); assert_eq!(log2.name(), String::from("logger")); assert_eq!(log2.full_name(), String::from("main.logger")); } #[test] fn console() { let log = logging::get("main.console".to_owned()); log.add_handler(logging::ConsoleHandler::new()); log.info("yes mam".to_owned()); } #[test] fn thread_safe() { let log = logging::get("main".to_owned()); log.info("start".to_owned()); { let log = log.clone(); std::thread::spawn(move || for i in 0..3 { log.debug(format!("count: {}", i)); }); } log.info("end".to_owned()); }