mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-20 01:52:15 +00:00
1250 - add NO_COLOR env var to disable logs colors (#1503)
Fix #1250 Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1503 Reviewed-by: Alex <lx@deuxfleurs.fr>
This commit is contained in:
@@ -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:
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user