Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 671 Bytes

log-stdout.zh.md

File metadata and controls

24 lines (17 loc) · 671 Bytes

登录到 stdout 而不是 stderr

[![log-badge]][log] [![env_logger-badge]][env_logger] [![cat-debugging-badge]][cat-debugging]

使用Builder::target创建一个自定义记录器配置,将日志输出的目标设置为Target::Stdout

#[macro_use]
extern crate log;
extern crate env_logger;

use env_logger::{Builder, Target};

fn main() {
    Builder::new()
        .target(Target::Stdout)
        .init();

    error!("This error has been printed to Stdout");
}