mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 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:
@@ -40,10 +40,7 @@
|
||||
use sp_std::prelude::*;
|
||||
|
||||
use codec::{self as codec, Decode, Encode};
|
||||
use frame_support::{
|
||||
debug,
|
||||
traits::{Get, KeyOwnerProofSystem},
|
||||
};
|
||||
use frame_support::traits::{Get, KeyOwnerProofSystem};
|
||||
use sp_finality_grandpa::{EquivocationProof, RoundNumber, SetId};
|
||||
use sp_runtime::{
|
||||
transaction_validity::{
|
||||
@@ -174,8 +171,15 @@ where
|
||||
let call = Call::report_equivocation_unsigned(equivocation_proof, key_owner_proof);
|
||||
|
||||
match SubmitTransaction::<T, Call<T>>::submit_unsigned_transaction(call.into()) {
|
||||
Ok(()) => debug::info!("Submitted GRANDPA equivocation report."),
|
||||
Err(e) => debug::error!("Error submitting equivocation report: {:?}", e),
|
||||
Ok(()) => log::info!(
|
||||
target: "runtime::afg",
|
||||
"Submitted GRANDPA equivocation report.",
|
||||
),
|
||||
Err(e) => log::error!(
|
||||
target: "runtime::afg",
|
||||
"Error submitting equivocation report: {:?}",
|
||||
e,
|
||||
),
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -207,8 +211,8 @@ impl<T: Config> frame_support::unsigned::ValidateUnsigned for Module<T> {
|
||||
match source {
|
||||
TransactionSource::Local | TransactionSource::InBlock => { /* allowed */ }
|
||||
_ => {
|
||||
debug::warn!(
|
||||
target: "afg",
|
||||
log::warn!(
|
||||
target: "runtime::afg",
|
||||
"rejecting unsigned report equivocation transaction because it is not local/in-block."
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user