Skip to content

Commit

Permalink
Merge pull request #6119 from benesch/term-colors
Browse files Browse the repository at this point in the history
materialized: don't emit colored log output to stderr if not tty
  • Loading branch information
benesch committed Mar 17, 2021
2 parents d463129 + 440fb9b commit 7ee0ed4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/materialized/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ name = "materialized-unstable"
anyhow = "1.0.38"
askama = { version = "0.10.5", features = ["serde-json"] }
async-trait = "0.1.48"
atty = "0.2.14"
backtrace = "0.3.56"
build-info = { path = "../build-info" }
cfg-if = "1.0.0"
Expand Down
10 changes: 8 additions & 2 deletions src/materialized/src/bin/materialized/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,11 @@ fn run(args: Args) -> Result<(), anyhow::Error> {
// with the user-specified `env_filter`.
tracing_subscriber::registry()
.with(env_filter)
.with(fmt::layer().with_writer(io::stderr))
.with(
fmt::layer()
.with_writer(io::stderr)
.with_ansi(atty::is(atty::Stream::Stderr)),
)
.init()
}
log_file => {
Expand Down Expand Up @@ -444,7 +448,9 @@ fn run(args: Args) -> Result<(), anyhow::Error> {
})
})
.with(FilterLayer::new(
fmt::layer().with_writer(io::stderr),
fmt::layer()
.with_writer(io::stderr)
.with_ansi(atty::is(atty::Stream::Stderr)),
stderr_level,
))
.init()
Expand Down

0 comments on commit 7ee0ed4

Please sign in to comment.