introduce log-target constant to more frame pallets (#13116)

* introduce log-target constant to more frame pallets

* cargo fmt

* make LOG_TARGET in session public

* Update frame/elections-phragmen/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/elections-phragmen/src/migrations/v3.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/elections-phragmen/src/migrations/v3.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/elections-phragmen/src/migrations/v3.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* move LOG_TARGET=runtime::session_historical to migrations module, where it's actually used

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Anthony Alaribe
2023-01-10 20:18:12 +01:00
committed by GitHub
parent 72f086b795
commit c04e68fd01
18 changed files with 89 additions and 71 deletions
+5 -10
View File
@@ -122,6 +122,8 @@ pub use weights::WeightInfo;
/// All migrations.
pub mod migrations;
const LOG_TARGET: &str = "runtime::elections-phragmen";
/// The maximum votes allowed per voter.
pub const MAXIMUM_VOTE: usize = 16;
@@ -789,10 +791,7 @@ impl<T: Config> Pallet<T> {
} else {
// overlap. This can never happen. If so, it seems like our intended replacement
// is already a member, so not much more to do.
log::error!(
target: "runtime::elections-phragmen",
"A member seems to also be a runner-up.",
);
log::error!(target: LOG_TARGET, "A member seems to also be a runner-up.");
}
next_best
});
@@ -939,7 +938,7 @@ impl<T: Config> Pallet<T> {
Ok(_) => (),
Err(_) => {
log::error!(
target: "runtime::elections-phragmen",
target: LOG_TARGET,
"Failed to run election. Number of voters exceeded",
);
Self::deposit_event(Event::ElectionError);
@@ -1103,11 +1102,7 @@ impl<T: Config> Pallet<T> {
<ElectionRounds<T>>::mutate(|v| *v += 1);
})
.map_err(|e| {
log::error!(
target: "runtime::elections-phragmen",
"Failed to run election [{:?}].",
e,
);
log::error!(target: LOG_TARGET, "Failed to run election [{:?}].", e,);
Self::deposit_event(Event::ElectionError);
});