-
-
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
[Merged by Bors] - Clarify duplicate logger error #6757
[Merged by Bors] - Clarify duplicate logger error #6757
Conversation
crates/bevy_log/src/lib.rs
Outdated
@@ -115,7 +115,7 @@ impl Plugin for LogPlugin { | |||
} | |||
|
|||
let default_filter = { format!("{},{}", self.level, self.filter) }; | |||
LogTracer::init().unwrap(); | |||
LogTracer::init().expect("Could not set global logger as it has already been set. Please disable LogPlugin from Bevy's DefaultPlugins"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if we should just downgrade this to a warning instead
LogTracer::init().expect("Could not set global logger as it has already been set. Please disable LogPlugin from Bevy's DefaultPlugins"); | |
LogTracer::init() | |
.unwrap_or_else(|| warn!("Could not set global logger as it has already been set. Please disable LogPlugin from Bevy's DefaultPlugins")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that's pretty reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Downgraded to warning.
58d0cd4
to
64526f5
Compare
bors r+ |
# 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
Pull request successfully merged into main. Build succeeded:
|
# 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
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