Skip to content

Fix the inverted RUST_LOG filter #17331

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

Merged
merged 1 commit into from
Sep 17, 2014

Conversation

lilyball
Copy link
Contributor

RUST_LOG supports regex filtering of log messages with a syntax like
RUST_LOG=main/foo to use the regex filter 'foo'. Unfortunately, the
filter was inverted, so RUST_LOG=main/foo would actually show all
messages except the ones containing 'foo'.

@alexcrichton
Copy link
Member

Can you add a test for this as well?

@lilyball
Copy link
Contributor Author

@alexcrichton What, like a run-make test?

@alexcrichton
Copy link
Member

You also have the choice of a run-pass test with an exec-env, a run-pass test spawning a subprocess, or making the code itself unit-testable and testing inside of liblog.

@lilyball
Copy link
Contributor Author

How would a run-pass test work? You can use error patterns, but I'm not aware of any way to test the stdout of the process.

@alexcrichton
Copy link
Member

You can call set_logger to capture the output.

@lilyball
Copy link
Contributor Author

Ah hah, I can instruct it to examine stdout, and then I should just be able to use the error-pattern directive.

@lilyball
Copy link
Contributor Author

Heh I didn't even realize set_logger was a thing. That might make this easier.

RUST_LOG supports regex filtering of log messages with a syntax like
`RUST_LOG=main/foo` to use the regex filter 'foo'. Unfortunately, the
filter was inverted, so `RUST_LOG=main/foo` would actually show all
messages except the ones containing 'foo'.
@lilyball lilyball force-pushed the rust_log_pattern_inverted branch from 13b02c5 to e7b2570 Compare September 17, 2014 20:26
@lilyball
Copy link
Contributor Author

@alexcrichton Updated with a test.

bors added a commit that referenced this pull request Sep 17, 2014
…xcrichton

RUST_LOG supports regex filtering of log messages with a syntax like
`RUST_LOG=main/foo` to use the regex filter 'foo'. Unfortunately, the
filter was inverted, so `RUST_LOG=main/foo` would actually show all
messages except the ones containing 'foo'.
@bors bors closed this Sep 17, 2014
@bors bors merged commit e7b2570 into rust-lang:master Sep 17, 2014
@lilyball lilyball deleted the rust_log_pattern_inverted branch September 21, 2014 23:06
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.

3 participants