Skip to content
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

subscriber: enable TestWriter to write to stderr #3187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

d-e-s-o
Copy link
Contributor

@d-e-s-o d-e-s-o commented Jan 5, 2025

It can be useful to have a TestWriter that does not log to stdout but stderr instead. For example, that allows for potentially easier filtering of tracing output (because the remaining output of, say, cargo test goes to stdout) or to mirror behavior of env_logger, which by default logs to stderr.
Introduce the TestWriter::with_stderr() constructor to enable such usage. The default is left unchanged.

It can be useful to have a TestWriter that does not log to stdout but
stderr instead. For example, that allows for potentially easier
filtering of tracing output (because the remaining output of, say, cargo
test goes to stdout) or to mirror behavior of env_logger, which by
default logs to stderr.
Introduce the TestWriter::with_stderr() constructor to enable such
usage. The default is left unchanged.
@d-e-s-o d-e-s-o requested review from hawkw, davidbarsky and a team as code owners January 5, 2025 21:51
d-e-s-o added a commit to d-e-s-o/test-log that referenced this pull request Jan 5, 2025
env_logger was doing it, tracing wasn't. Make sure that both do it.

Requires tokio-rs/tracing#3187
@d-e-s-o d-e-s-o force-pushed the topic/test-writer-stderr branch from 85c3826 to 00ab32a Compare February 10, 2025 15:34
Copy link
Contributor

@joshka joshka left a comment

Choose a reason for hiding this comment

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

LGTM. My comments about whether to pass a writer type was incorrect due to rust-lang/rust#90785. This PR is a reasonable approach to this change to add stderr.

@d-e-s-o d-e-s-o force-pushed the topic/test-writer-stderr branch from acb3a40 to b8dfbe8 Compare February 12, 2025 15:48
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.

2 participants