Skip to content

Commit 3d75d77

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

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/handler.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ impl EventHandler for Handler {
265265
Ok(m) => m,
266266
Err(e) => {
267267
// We can't return an error, but we also can't proceed, so log the error
268-
// and bare-return to bail out.
268+
// and early-return to bail out.
269269
tracing::error!(%e, "failed to get message info for message");
270270
return;
271271
}

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)