5 个版本
| 0.1.5 | 2019年11月29日 |
|---|---|
| 0.1.4 | 2019年11月17日 |
| 0.1.3 | 2019年9月27日 |
| 0.1.2 | 2019年9月27日 |
| 0.1.1 | 2019年9月27日 |
#776 in 调试
每月21次下载
10KB
155 行
Aver
Aver 是一个简单易用的 Rust 日志库。目前支持颜色、日志级别和更简单的语法。此库无需依赖(如果你使用 Windows,则需要 winapi,抱歉。)
安装
只需将以下内容添加到你的 Cargo.toml 文件中
aver = "0.1.5"
使用方法
你可以在项目中通过包含 extern crate aver 来开始使用 aver。然后使用其命令之一。
log_trace!("this is a trace method, it is disabled by default (see below)");
log_debug!("same as above!");
log_info!("any of these can take ", "any ", "number of arguments");
log_warn!("can they be of any type? ", true);
log_error!("An error");
log_fatal!("Even worse than ana error!");
日志级别
Aver 提供了 8 个日志级别:All、Trace、Debug、Info、Warn、Error、Fatal、Off。按优先级顺序排列。你可以使用 aver::set_log_level(LogLevel) 设置日志级别,默认情况下 aver 使用 Info,这意味着跟踪和调试将被禁用。
颜色
使用颜色的方法很简单
log_info!(aver::colors::blue(), "this will be shown in blue!", aver::colors::reset(), " and this won't");
log_info!(aver::colors::on_blue(), "this will be shown on blue!", aver::colors::reset(), " and this won't");
目前支持以下颜色:文本颜色支持 white、grey、red、yellow、green、cyan、blue 和 magenta,背景颜色支持 on_white、on_grey、on_red、on_yellow、on_green、on_cyan、on_blue 和 on_magenta。
依赖项
~175KB