-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-enhancementCategory: Enhancement or feature requestCategory: Enhancement or feature request
Description
Problem
Currently, all preprocessors need to call their own logging library. As calls to preprocessors are done within the main mdBook process, it would make sense to have a uniform logger across all preprocessors, so that when they log messages, it does not look weird compared to mdBook's own logging.
Proposed Solution
Move main::init_logger to utils::init_logger and make it public, so that people can opt in for the same logger as mdBook.
Lines 97 to 121 in efb671a
| fn init_logger() { | |
| let mut builder = Builder::new(); | |
| builder.format(|formatter, record| { | |
| writeln!( | |
| formatter, | |
| "{} [{}] ({}): {}", | |
| Local::now().format("%Y-%m-%d %H:%M:%S"), | |
| record.level(), | |
| record.target(), | |
| record.args() | |
| ) | |
| }); | |
| if let Ok(var) = env::var("RUST_LOG") { | |
| builder.parse_filters(&var); | |
| } else { | |
| // if no RUST_LOG provided, default to logging at the Info level | |
| builder.filter(None, LevelFilter::Info); | |
| // Filter extraneous html5ever not-implemented messages | |
| builder.filter(Some("html5ever"), LevelFilter::Error); | |
| } | |
| builder.init(); | |
| } |
Notes
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: Enhancement or feature requestCategory: Enhancement or feature request