-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Avoid unwrap log initialization #4934
Comments
when you are using multiple app (or in test), you should setup login yourself, and not add the |
Hi, thanks for your comment. I wouldn't like to configure by myself the log part because:
If my solution (adds a flag |
|
|
Honestly to me it feels like |
Fair enough. |
please do. having to change it locally is annoying. |
I tried changing It does work at preventing it from panicking, but the problem is that it seems to be circumventing whatever magic
@bjorn3 do you know of a solution to this? I would be happy to make a PR if so, since would go well with #5931. |
Maybe the same thread pool is reused by multiple tests and once the test spawning the thread pool tests initially libtest doesn't know to which test to attribute the output anymore? |
# Objective When a global tracing subscriber has already been set, `LogPlugin` panics with an error message explaining this. However, if a global logger has already been set, it simply panics on an unwrap. #6426 mentiones the panic and has been fixed by unique plugins, but the panic can still occur if a logger has been set through different means or multiple apps are created, as in #4934. The solution to that specific case isn't clear; this PR only fixes the missing error message. ## Solution - ~add error message to panic~ - turn into warning
# Objective When a global tracing subscriber has already been set, `LogPlugin` panics with an error message explaining this. However, if a global logger has already been set, it simply panics on an unwrap. bevyengine#6426 mentiones the panic and has been fixed by unique plugins, but the panic can still occur if a logger has been set through different means or multiple apps are created, as in bevyengine#4934. The solution to that specific case isn't clear; this PR only fixes the missing error message. ## Solution - ~add error message to panic~ - turn into warning
# Objective When a global tracing subscriber has already been set, `LogPlugin` panics with an error message explaining this. However, if a global logger has already been set, it simply panics on an unwrap. bevyengine#6426 mentiones the panic and has been fixed by unique plugins, but the panic can still occur if a logger has been set through different means or multiple apps are created, as in bevyengine#4934. The solution to that specific case isn't clear; this PR only fixes the missing error message. ## Solution - ~add error message to panic~ - turn into warning
# Objective When a global tracing subscriber has already been set, `LogPlugin` panics with an error message explaining this. However, if a global logger has already been set, it simply panics on an unwrap. bevyengine#6426 mentiones the panic and has been fixed by unique plugins, but the panic can still occur if a logger has been set through different means or multiple apps are created, as in bevyengine#4934. The solution to that specific case isn't clear; this PR only fixes the missing error message. ## Solution - ~add error message to panic~ - turn into warning
This was changed to a non-panicking warning in #6757. |
What problem does this solve or what need does it fill?
I would like to test heavily my application. Obviously my test suite is composed by multiple test and every test create a new through
App::new()
and register the plugin I need to the new app instance.Because logs are important I really would like keep them active during the tests runs.
What solution would you like?
Remove the
unwrap
from herebevy/crates/bevy_log/src/lib.rs
Line 127 in 5e2cfb2
What alternative(s) have you considered?
Remove LogPlugin from my tests
Additional context
Error log:
The text was updated successfully, but these errors were encountered: