mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-23 06:11:07 +00:00
Init RuntimeLogger automatically for each runtime api call (#8128)
* Init `RuntimeLogger` automatically for each runtime api call This pr change the runtime api in such a way to always and automatically enable the `RuntimeLogger`. This enables the user to use `log` or `tracing` from inside the runtime to create log messages. As logging introduces some extra code and especially increases the size of the wasm blob. It is advised to disable all logging completely with `sp-api/disable-logging` when doing the wasm builds for the on-chain wasm runtime. Besides these changes, the pr also brings most of the logging found in frame to the same format "runtime::*". * Update frame/im-online/src/lib.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Update test-utils/runtime/Cargo.toml * Fix test * Don't use tracing in the runtime, as we don't support it :D * Fixes Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -49,7 +49,7 @@ use sp_runtime::{RuntimeDebug, traits::Hash};
|
||||
|
||||
use frame_support::{
|
||||
codec::{Decode, Encode},
|
||||
debug, decl_error, decl_event, decl_module, decl_storage,
|
||||
decl_error, decl_event, decl_module, decl_storage,
|
||||
dispatch::{
|
||||
DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable, Parameter,
|
||||
PostDispatchInfo,
|
||||
@@ -320,19 +320,21 @@ decl_module! {
|
||||
) -> DispatchResultWithPostInfo {
|
||||
ensure_root(origin)?;
|
||||
if new_members.len() > T::MaxMembers::get() as usize {
|
||||
debug::error!(
|
||||
"New members count exceeds maximum amount of members expected. (expected: {}, actual: {})",
|
||||
log::error!(
|
||||
target: "runtime::collective",
|
||||
"New members count ({}) exceeds maximum amount of members expected ({}).",
|
||||
new_members.len(),
|
||||
T::MaxMembers::get(),
|
||||
new_members.len()
|
||||
);
|
||||
}
|
||||
|
||||
let old = Members::<T, I>::get();
|
||||
if old.len() > old_count as usize {
|
||||
debug::warn!(
|
||||
"Wrong count used to estimate set_members weight. (expected: {}, actual: {})",
|
||||
log::warn!(
|
||||
target: "runtime::collective",
|
||||
"Wrong count used to estimate set_members weight. expected ({}) vs actual ({})",
|
||||
old_count,
|
||||
old.len()
|
||||
old.len(),
|
||||
);
|
||||
}
|
||||
let mut new_members = new_members;
|
||||
@@ -811,10 +813,11 @@ impl<T: Config<I>, I: Instance> ChangeMembers<T::AccountId> for Module<T, I> {
|
||||
new: &[T::AccountId],
|
||||
) {
|
||||
if new.len() > T::MaxMembers::get() as usize {
|
||||
debug::error!(
|
||||
"New members count exceeds maximum amount of members expected. (expected: {}, actual: {})",
|
||||
log::error!(
|
||||
target: "runtime::collective",
|
||||
"New members count ({}) exceeds maximum amount of members expected ({}).",
|
||||
new.len(),
|
||||
T::MaxMembers::get(),
|
||||
new.len()
|
||||
);
|
||||
}
|
||||
// remove accounts from all current voting in motions.
|
||||
|
||||
Reference in New Issue
Block a user