Skip to content

feat(tracing): Replace println/eprintln with tracing#116

Open
jan-auer wants to merge 1 commit intomainfrom
feat/tracing
Open

feat(tracing): Replace println/eprintln with tracing#116
jan-auer wants to merge 1 commit intomainfrom
feat/tracing

Conversation

@jan-auer
Copy link
Copy Markdown
Member

@jan-auer jan-auer commented Apr 9, 2026

Applications embedding sentry-options as a dependency may have their own logging sinks — a Sentry SDK, a structured log aggregator, or similar. Hard-coded eprintln/println bypasses those sinks entirely.

By emitting events through the tracing crate, the host application controls how and where they are captured. The CLI gets a compact, time-free tracing-subscriber at INFO level so its own output is unaffected.

Applications embedding sentry-options as a dependency may have their
own logging sinks (e.g. a Sentry SDK or structured log aggregator).
Hard-coded eprintln/println bypasses those sinks entirely.

By emitting events through the tracing crate instead, the host
application decides how and where they are captured. The CLI gets a
compact, time-free tracing-subscriber at INFO level so its own output
is unaffected.

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 06ffd5d. Configure here.


if let Err(e) = result {
eprintln!("{}", e);
tracing::error!(error = %e);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error event missing message string unlike all others

Medium Severity

tracing::error!(error = %e) is the only tracing call across the entire diff that omits a message string. Every other call follows the pattern tracing::level!(fields, "Human-readable message"). Without a message, the compact formatter produces output like ERROR error=I/O error: ... instead of something like ERROR Command failed error=I/O error: .... For a CLI's top-level error handler, this makes the output less user-friendly compared to the original eprintln!("{}", e) which printed just the error text.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 06ffd5d. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the error contains the message, I think this is fine here, but it may still make sense to add a message describing the context.

namespaces = ?namespaces,
elapsed_ms = reload_duration.as_millis(),
"Reloaded values",
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New INFO log added in library reload path

Low Severity

The tracing::info!("Reloaded values", ...) call is not replacing an existing println!/eprintln! — it's entirely new logging added to the success path of reload_values. The old code only had an eprintln for the error case. This fires every time the background file-watcher detects a change and successfully reloads values. For a library crate, this adds a recurring INFO-level event that host applications may not expect, going beyond the PR's stated scope of replacing existing print statements.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 06ffd5d. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this on purpose, as I found it useful to get an INFO-level log when this happens. Feel free to revert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant