diff --git a/doc/book/reference-manual/configuration.md b/doc/book/reference-manual/configuration.md index d5c60b10..e43285f7 100644 --- a/doc/book/reference-manual/configuration.md +++ b/doc/book/reference-manual/configuration.md @@ -175,6 +175,9 @@ they do not exist in the configuration file: Garage daemon send its logs to `journald` (using the native protocol of `systemd-journald`) instead of printing to stderr. +- `NO_COLOR` (since `v2.4.0`): set this to `0` or `false` to disable + ANSI color codes in Garage's logs. + The following environment variables can be used to override the corresponding values in the configuration file: diff --git a/src/garage/main.rs b/src/garage/main.rs index 62d10c82..27577560 100644 --- a/src/garage/main.rs +++ b/src/garage/main.rs @@ -276,6 +276,11 @@ fn init_logging(opt: &Opt) { tracing_subscriber::fmt() .with_writer(std::io::stderr) .with_env_filter(env_filter) + .with_ansi( + std::env::var("NO_COLOR") + .map(|x| x != "0" && !x.eq_ignore_ascii_case("false")) + .unwrap_or(true), + ) .init(); }