mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add flag to CLI to disable colour coding of console output (#4033)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -43,13 +43,14 @@ pub fn init(layers: Vec<BoxedLayer<Registry>>) {
|
||||
///
|
||||
/// Colors can be disabled with `RUST_LOG_STYLE=never`, and event targets can be displayed with
|
||||
/// `RUST_LOG_TARGET=1`.
|
||||
pub fn stdout<S>(default_directive: impl Into<Directive>) -> BoxedLayer<S>
|
||||
pub fn stdout<S>(default_directive: impl Into<Directive>, color: &str) -> BoxedLayer<S>
|
||||
where
|
||||
S: Subscriber,
|
||||
for<'a> S: LookupSpan<'a>,
|
||||
{
|
||||
// TODO: Auto-detect
|
||||
let with_ansi = std::env::var("RUST_LOG_STYLE").map(|val| val != "never").unwrap_or(true);
|
||||
let with_ansi =
|
||||
std::env::var("RUST_LOG_STYLE").map(|val| val != "never").unwrap_or(color != "never");
|
||||
let with_target = std::env::var("RUST_LOG_TARGET").map(|val| val != "0").unwrap_or(true);
|
||||
|
||||
let filter =
|
||||
|
||||
Reference in New Issue
Block a user