【发布时间】:2016-05-19 06:55:09
【问题描述】:
#[macro_use]
extern crate log;
fn whatever() {
info!("whatever")
}
#[test]
fn test() {
whatever();
}
我想在运行单元测试后查看日志(cargo test),
怎么可能现在?
【问题讨论】:
标签: unit-testing testing logging rust rust-cargo
#[macro_use]
extern crate log;
fn whatever() {
info!("whatever")
}
#[test]
fn test() {
whatever();
}
我想在运行单元测试后查看日志(cargo test),
怎么可能现在?
【问题讨论】:
标签: unit-testing testing logging rust rust-cargo
log crate 自身不进行任何日志记录。来自the main documentation page:
如果没有选择日志实现,外观会退回到忽略所有日志消息的“noop”实现。
为了让您的日志消息可以发送到任何地方,您必须初始化一个特定的日志实现,例如env_logger。不过,现在看来,there is no way to perform initialization before tests are run。
【讨论】: