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
+6 -4
View File
@@ -29,6 +29,8 @@ use frame_support::{
use crate::historical as pallet_session_historical;
const LOG_TARGET: &str = "runtime::session_historical";
const OLD_PREFIX: &str = "Session";
/// Migrate the entire storage of this pallet to a new prefix.
@@ -44,7 +46,7 @@ pub fn migrate<T: pallet_session_historical::Config, P: GetStorageVersion + Pall
if new_pallet_name == OLD_PREFIX {
log::info!(
target: "runtime::session_historical",
target: LOG_TARGET,
"New pallet name is equal to the old prefix. No migration needs to be done.",
);
return Weight::zero()
@@ -52,7 +54,7 @@ pub fn migrate<T: pallet_session_historical::Config, P: GetStorageVersion + Pall
let on_chain_storage_version = <P as GetStorageVersion>::on_chain_storage_version();
log::info!(
target: "runtime::session_historical",
target: LOG_TARGET,
"Running migration to v1 for session_historical with storage version {:?}",
on_chain_storage_version,
);
@@ -78,7 +80,7 @@ pub fn migrate<T: pallet_session_historical::Config, P: GetStorageVersion + Pall
<T as frame_system::Config>::BlockWeights::get().max_block
} else {
log::warn!(
target: "runtime::session_historical",
target: LOG_TARGET,
"Attempted to apply migration to v1 but failed because storage version is {:?}",
on_chain_storage_version,
);
@@ -184,7 +186,7 @@ pub fn post_migrate<
fn log_migration(stage: &str, storage_prefix: &[u8], old_pallet_name: &str, new_pallet_name: &str) {
log::info!(
target: "runtime::session_historical",
target: LOG_TARGET,
"{} prefix of storage '{}': '{}' ==> '{}'",
stage,
str::from_utf8(storage_prefix).unwrap_or("<Invalid UTF8>"),