-
Notifications
You must be signed in to change notification settings - Fork 35
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
Allow to set default log level #25
Comments
That doesn't seem particularly flexible to me, because we'd have to hard code the default level to use, right? Meaning users wouldn't be able to select I think an argument could be made to always log at |
Defaults would be very useful, sometimes coming back to the tests after a long time I forget I can run the tests with RUST_LOG=info. One thing I've done in the past is checking to see if the |
Can you elaborate some more on what exactly you had in mind? |
EDIT: After some more thought, maybe this can be an attribute rather than a crate-wide feature that way it can be more configurable. Maybe something like:
which expands to something like (I'm just making this up, not sure what the code expands to right now):
Looking at the env_logger docs, this will parse the filter from RUST_LOG or default to "info,foo=debug" if there is nothing in the env: Haven't tested it though. |
Ah, yeah, I think an argument to the attribute is a much easier sell than a crate-wide thing and would be entirely reasonable. Haven't thought through all the details yet either, but feel free to open a pull request. |
Users can now specify a default_log_filter via #[test_log(default_log_filter = "foo")] which will be used when RUST_LOG is not specified. Please note that because env_logger is initialized globally, it is possible that this value will be ignored if the logger is already initialized. Fixes: d-e-s-o#25
Users can now specify a default_log_filter via #[test_log(default_log_filter = "foo")] which will be used when RUST_LOG is not specified. Please note that because env_logger is initialized globally, it is possible that this value will be ignored if the logger is already initialized. Fixes: d-e-s-o#25
Users can now specify a default_log_filter via #[test_log(default_log_filter = "foo")] which will be used when RUST_LOG is not specified. Please note that because env_logger is initialized globally, it is possible that this value will be ignored if the logger is already initialized. Fixes: d-e-s-o#25
Users can now specify a default_log_filter via #[test_log(default_log_filter = "foo")] which will be used when RUST_LOG is not specified. Please note that because env_logger / tracing is initialized globally, it is possible that this value will be ignored if they have already been initialized by a different test. Fixes: d-e-s-o#25
Users can now specify a default_log_filter via #[test_log(default_log_filter = "foo")] which will be used when RUST_LOG is not specified. Please note that because env_logger / tracing is initialized globally, it is possible that this value will be ignored if they have already been initialized by a different test. Fixes: #25
Users can now specify a default_log_filter via #[test_log(default_log_filter = "foo")] which will be used when RUST_LOG is not specified. Please note that because env_logger / tracing is initialized globally, it is possible that this value will be ignored if they have already been initialized by a different test. Fixes: #25
Users can now specify a default_log_filter via #[test_log(default_log_filter = "foo")] which will be used when RUST_LOG is not specified. Please note that because env_logger / tracing is initialized globally, it is possible that this value will be ignored if they have already been initialized by a different test. Fixes: #25
Currently
info
output won't be displayed unless I setRUST_LOG=info
.I would suggest to add a default log level via Cargo feature.
The text was updated successfully, but these errors were encountered: