mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +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:
@@ -85,7 +85,7 @@ use sp_runtime::{
|
||||
|
||||
use sp_core::{ChangesTrieConfiguration, storage::well_known_keys};
|
||||
use frame_support::{
|
||||
Parameter, debug, storage,
|
||||
Parameter, storage,
|
||||
traits::{
|
||||
Contains, Get, PalletInfo, OnNewAccount, OnKilledAccount, HandleLifetime,
|
||||
StoredMap, EnsureOrigin, OriginTrait, Filter,
|
||||
@@ -1060,7 +1060,10 @@ impl<T: Config> Module<T> {
|
||||
(0, _) => {
|
||||
// Logic error - cannot decrement beyond zero and no item should
|
||||
// exist with zero providers.
|
||||
debug::print!("Logic error: Unexpected underflow in reducing provider");
|
||||
log::error!(
|
||||
target: "runtime::system",
|
||||
"Logic error: Unexpected underflow in reducing provider",
|
||||
);
|
||||
Ok(DecRefStatus::Reaped)
|
||||
},
|
||||
(1, 0) => {
|
||||
@@ -1078,7 +1081,10 @@ impl<T: Config> Module<T> {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
debug::print!("Logic error: Account already dead when reducing provider");
|
||||
log::error!(
|
||||
target: "runtime::system",
|
||||
"Logic error: Account already dead when reducing provider",
|
||||
);
|
||||
Ok(DecRefStatus::Reaped)
|
||||
}
|
||||
})
|
||||
@@ -1107,7 +1113,10 @@ impl<T: Config> Module<T> {
|
||||
Account::<T>::mutate(who, |a| if a.consumers > 0 {
|
||||
a.consumers -= 1;
|
||||
} else {
|
||||
debug::print!("Logic error: Unexpected underflow in reducing consumer");
|
||||
log::error!(
|
||||
target: "runtime::system",
|
||||
"Logic error: Unexpected underflow in reducing consumer",
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ use sp_std::convert::{TryInto, TryFrom};
|
||||
use sp_std::prelude::{Box, Vec};
|
||||
use sp_runtime::app_crypto::RuntimeAppPublic;
|
||||
use sp_runtime::traits::{Extrinsic as ExtrinsicT, IdentifyAccount, One};
|
||||
use frame_support::{debug, RuntimeDebug};
|
||||
use frame_support::RuntimeDebug;
|
||||
|
||||
/// Marker struct used to flag using all supported keys to sign a payload.
|
||||
pub struct ForAll {}
|
||||
@@ -550,8 +550,8 @@ pub trait SendSignedTransaction<
|
||||
call: LocalCall,
|
||||
) -> Option<Result<(), ()>> {
|
||||
let mut account_data = crate::Account::<T>::get(&account.id);
|
||||
debug::native::debug!(
|
||||
target: "offchain",
|
||||
log::debug!(
|
||||
target: "runtime::offchain",
|
||||
"Creating signed transaction from account: {:?} (nonce: {:?})",
|
||||
account.id,
|
||||
account_data.nonce,
|
||||
|
||||
Reference in New Issue
Block a user