Skip to content

Commit

Permalink
Remove unnecessary wildcards from LogPlugin and convert warnings to…
Browse files Browse the repository at this point in the history
… errors. (bevyengine#12046)

# Objective

Improve code quality and prevent bugs.

## Solution

I removed the unnecessary wildcards from `<LogPlugin as Plugin>::build`.

I also changed the warnings that would occur if the subscriber/logger
was already set into errors.
  • Loading branch information
doonv authored and msvbg committed Feb 26, 2024
1 parent b488ab5 commit bd22354
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/bevy_log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ impl Plugin for LogPlugin {
bevy_utils::tracing::subscriber::set_global_default(finished_subscriber).is_err();

match (logger_already_set, subscriber_already_set) {
(true, true) => warn!(
(true, true) => error!(
"Could not set global logger and tracing subscriber as they are already set. Consider disabling LogPlugin."
),
(true, _) => warn!("Could not set global logger as it is already set. Consider disabling LogPlugin."),
(_, true) => warn!("Could not set global tracing subscriber as it is already set. Consider disabling LogPlugin."),
_ => (),
(true, false) => error!("Could not set global logger as it is already set. Consider disabling LogPlugin."),
(false, true) => error!("Could not set global tracing subscriber as it is already set. Consider disabling LogPlugin."),
(false, false) => (),
}
}
}

0 comments on commit bd22354

Please sign in to comment.