-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: don't hard-error on unreadable messages #103
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
use std::io::IsTerminal as _; | ||
use tracing_subscriber::{prelude::*, EnvFilter}; | ||
|
||
/// Initializes a tracing subscriber. | ||
pub(crate) fn init_subscriber() -> anyhow::Result<()> { | ||
let fmt_layer = tracing_subscriber::fmt::layer().with_target(true); | ||
let fmt_layer = tracing_subscriber::fmt::layer() | ||
.with_target(true) | ||
.with_ansi(std::io::stderr().is_terminal()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logging to stderr feels mildly surprising to me, but i don't have a strong opinion about this 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, subjective, I guess. Putting on my sysadmin hat, I feel strongly that "stdout is for output, stderr is for logging and diagnostics." But in the case of |
||
.with_writer(std::io::stderr); | ||
let filter_layer = EnvFilter::try_from_default_env() | ||
.or_else(|_| EnvFilter::try_new("info"))? | ||
// Force disabling of r1cs log messages, otherwise the `ark-groth16` crate | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great 👍
eventually it could be cool to expose a metric counting messages observed / parsed, but that's another item for the rainy day bucket 🙂