mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Fix logging from inside the WASM runtime (#7355)
* Fix logging from inside the WASM runtime When using `RuntimeLogger` to log something from the runtime, we didn't set any logging level. So, we actually did not log anything from the runtime as logging is disabled by default. This pr fixes that by setting the logging level to `TRACE`. It also adds a test to ensure this does not break again ;) * Update frame/support/src/debug.rs
This commit is contained in:
@@ -340,6 +340,8 @@ cfg_if! {
|
||||
/// Test that ensures that we can call a function that takes multiple
|
||||
/// arguments.
|
||||
fn test_multiple_arguments(data: Vec<u8>, other: Vec<u8>, num: u32);
|
||||
/// Traces log "Hey I'm runtime."
|
||||
fn do_trace_log();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -391,6 +393,8 @@ cfg_if! {
|
||||
/// Test that ensures that we can call a function that takes multiple
|
||||
/// arguments.
|
||||
fn test_multiple_arguments(data: Vec<u8>, other: Vec<u8>, num: u32);
|
||||
/// Traces log "Hey I'm runtime."
|
||||
fn do_trace_log();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -698,6 +702,11 @@ cfg_if! {
|
||||
assert_eq!(&data[..], &other[..]);
|
||||
assert_eq!(data.len(), num as usize);
|
||||
}
|
||||
|
||||
fn do_trace_log() {
|
||||
frame_support::debug::RuntimeLogger::init();
|
||||
frame_support::debug::trace!("Hey I'm runtime");
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
|
||||
@@ -944,6 +953,11 @@ cfg_if! {
|
||||
assert_eq!(&data[..], &other[..]);
|
||||
assert_eq!(data.len(), num as usize);
|
||||
}
|
||||
|
||||
fn do_trace_log() {
|
||||
frame_support::debug::RuntimeLogger::init();
|
||||
frame_support::debug::trace!("Hey I'm runtime");
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
|
||||
|
||||
Reference in New Issue
Block a user