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
+4 -2
View File
@@ -193,6 +193,8 @@ pub use weights::WeightInfo;
pub use pallet::*;
const LOG_TARGET: &str = "runtime::balances";
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
#[frame_support::pallet]
@@ -950,7 +952,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
if locks.len() as u32 > T::MaxLocks::get() {
log::warn!(
target: "runtime::balances",
target: LOG_TARGET,
"Warning: A user has more currency locks than expected. \
A runtime configuration adjustment may be needed."
);
@@ -985,7 +987,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
// since the funds that are under the lock will themselves be stored in the
// account and therefore will need a reference.
log::warn!(
target: "runtime::balances",
target: LOG_TARGET,
"Warning: Attempt to introduce lock consumer reference, yet no providers. \
This is unexpected but should be safe."
);
+10 -4
View File
@@ -40,10 +40,13 @@ fn migrate_v0_to_v1<T: Config<I>, I: 'static>(accounts: &[T::AccountId]) -> Weig
// Set storage version to `1`.
StorageVersion::new(1).put::<Pallet<T, I>>();
log::info!(target: "runtime::balances", "Storage to version 1");
log::info!(target: LOG_TARGET, "Storage to version 1");
T::DbWeight::get().reads_writes(2 + accounts.len() as u64, 3)
} else {
log::info!(target: "runtime::balances", "Migration did not execute. This probably should be removed");
log::info!(
target: LOG_TARGET,
"Migration did not execute. This probably should be removed"
);
T::DbWeight::get().reads(1)
}
}
@@ -87,10 +90,13 @@ impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for ResetInactive<T, I> {
// Set storage version to `0`.
StorageVersion::new(0).put::<Pallet<T, I>>();
log::info!(target: "runtime::balances", "Storage to version 0");
log::info!(target: LOG_TARGET, "Storage to version 0");
T::DbWeight::get().reads_writes(1, 2)
} else {
log::info!(target: "runtime::balances", "Migration did not execute. This probably should be removed");
log::info!(
target: LOG_TARGET,
"Migration did not execute. This probably should be removed"
);
T::DbWeight::get().reads(1)
}
}