2个版本
0.1.1 | 2021年10月26日 |
---|---|
0.1.0 | 2021年10月15日 |
#545 在 调试
11KB
150 行
galacta-logger
为Rust提供的简单日志记录器。这个日志记录器无需初始化即可提供项目的详细调试信息(记录时间、日志级别、文件路径、行号、模块路径和函数名称)。
用法
use galacta_logger::{self,GalactaLogger,LevelFilter,prelude::*};
/// First initialize logger.
/// You may set "G_LOG_LEVEL" environment variable
/// If environment variable is set, argument of init function will be ignored
GalactaLogger::init(LevelFilter::Trace);
/// These are logs with specified target(unrecommended)
error!("This is errror");
warn!(target: "target","This is warning");
info!("This is info");
debug!("This is debug");
trace!("This is trace");
/// These are logs without specified target or initializations(recommended)
gerror!("This is errror");
gwarn!("This is warning");
ginfo!("This is info");
gdebug!("This is debug");
gtrace!("This is trace");
输出示例
[2021-10-26 20:38:03] [TRACE] galacta_logger::tests::test_gdebug
This is gtrace
galacta_logger::tests (src/lib.rs:229)
依赖
~1.5MB
~20K SLoC