1.0.2 |
|
---|
#21 in #console-log
10KB
167 代码行
Logging4Dummys
配置
配置构建如下
application_version = '' //Here comes the Version of the Current application in
application_name = '' //This is the name of the application
formatting = 'y/m/d h:M:s l'
//in this format y is the Year m is the Month d is the Day h is the Hour M is the Minute s is the Second and l is the logging Message
stdout = 'log'
//This defines where the Log is written to there are 3 Options: console, this logs the to the console, log, this logs into an log.log file, and both this
// logs into the console as well as into the log.log file
如何记录日志?
你需要调用 Fn() log()
这个 Fn() 接受两个参数,第一个是 Log 枚举,通过这个枚举你可以指定这是一个信息、警告还是错误,第二个参数需要是一个字符串
示例
use Logging4Dummys as log;
fn main() -> (){
log::Log(log::Log::Info, "This is an Info".to_string());
// Some Code
}
这个示例会将“这是一个信息”记录为信息
依赖项
~1.4–2.3MB
~43K SLoC