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
+9 -7
View File
@@ -129,6 +129,8 @@ pub use extensions::check_mortality::CheckMortality as CheckEra;
pub use frame_support::dispatch::RawOrigin;
pub use weights::WeightInfo;
const LOG_TARGET: &str = "runtime::system";
/// Compute the trie root of a list of extrinsics.
///
/// The merkle proof is using the same trie as runtime state with
@@ -1075,7 +1077,7 @@ impl<T: Config> Pallet<T> {
if account.providers == 0 {
// Logic error - cannot decrement beyond zero.
log::error!(
target: "runtime::system",
target: LOG_TARGET,
"Logic error: Unexpected underflow in reducing provider",
);
account.providers = 1;
@@ -1101,7 +1103,7 @@ impl<T: Config> Pallet<T> {
}
} else {
log::error!(
target: "runtime::system",
target: LOG_TARGET,
"Logic error: Account already dead when reducing provider",
);
Ok(DecRefStatus::Reaped)
@@ -1133,7 +1135,7 @@ impl<T: Config> Pallet<T> {
if account.sufficients == 0 {
// Logic error - cannot decrement beyond zero.
log::error!(
target: "runtime::system",
target: LOG_TARGET,
"Logic error: Unexpected underflow in reducing sufficients",
);
}
@@ -1150,7 +1152,7 @@ impl<T: Config> Pallet<T> {
}
} else {
log::error!(
target: "runtime::system",
target: LOG_TARGET,
"Logic error: Account already dead when reducing provider",
);
DecRefStatus::Reaped
@@ -1215,7 +1217,7 @@ impl<T: Config> Pallet<T> {
a.consumers -= 1;
} else {
log::error!(
target: "runtime::system",
target: LOG_TARGET,
"Logic error: Unexpected underflow in reducing consumer",
);
}
@@ -1337,7 +1339,7 @@ impl<T: Config> Pallet<T> {
/// resulting header for this block.
pub fn finalize() -> T::Header {
log::debug!(
target: "runtime::system",
target: LOG_TARGET,
"[{:?}] {} extrinsics, length: {} (normal {}%, op: {}%, mandatory {}%) / normal weight:\
{} ({}%) op weight {} ({}%) / mandatory weight {} ({}%)",
Self::block_number(),
@@ -1547,7 +1549,7 @@ impl<T: Config> Pallet<T> {
Ok(_) => Event::ExtrinsicSuccess { dispatch_info: info },
Err(err) => {
log::trace!(
target: "runtime::system",
target: LOG_TARGET,
"Extrinsic failed at block({:?}): {:?}",
Self::block_number(),
err,
+4 -3
View File
@@ -17,6 +17,7 @@
//! Migrate the reference counting state.
use super::LOG_TARGET;
use crate::{Config, Pallet};
use codec::{Decode, Encode, FullCodec};
use frame_support::{
@@ -75,7 +76,7 @@ pub fn migrate_from_single_u8_to_triple_ref_count<V: V2ToV3, T: Config>() -> Wei
Some(AccountInfo { nonce, consumers: rc as RefCount, providers: 1, sufficients: 0, data })
});
log::info!(
target: "runtime::system",
target: LOG_TARGET,
"Applied migration from single u8 to triple reference counting to {:?} elements.",
translated
);
@@ -94,7 +95,7 @@ pub fn migrate_from_single_to_triple_ref_count<V: V2ToV3, T: Config>() -> Weight
},
);
log::info!(
target: "runtime::system",
target: LOG_TARGET,
"Applied migration from single to triple reference counting to {:?} elements.",
translated
);
@@ -112,7 +113,7 @@ pub fn migrate_from_dual_to_triple_ref_count<V: V2ToV3, T: Config>() -> Weight {
},
);
log::info!(
target: "runtime::system",
target: LOG_TARGET,
"Applied migration from dual to triple reference counting to {:?} elements.",
translated
);