Skip to content

Commit 66466a7

Browse files
committed
fix: log to stderr, only color if no tty
Closes #87.
1 parent 515c8d6 commit 66466a7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/tracing.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
use std::io::IsTerminal as _;
12
use tracing_subscriber::{prelude::*, EnvFilter};
23

34
/// Initializes a tracing subscriber.
45
pub(crate) fn init_subscriber() -> anyhow::Result<()> {
5-
let fmt_layer = tracing_subscriber::fmt::layer().with_target(true);
6+
let fmt_layer = tracing_subscriber::fmt::layer()
7+
.with_target(true)
8+
.with_ansi(std::io::stderr().is_terminal())
9+
.with_writer(std::io::stderr);
610
let filter_layer = EnvFilter::try_from_default_env()
711
.or_else(|_| EnvFilter::try_new("info"))?
812
// Force disabling of r1cs log messages, otherwise the `ark-groth16` crate

0 commit comments

Comments
 (0)