mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 09:51:10 +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",
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user