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:
Bastian Köcher
2021-03-01 15:29:17 +01:00
committed by GitHub
parent f2d9bb9ea6
commit 68390d4085
65 changed files with 571 additions and 422 deletions
@@ -393,7 +393,7 @@ impl<
let value = match unhashed::get::<O>(&previous_key) {
Some(value) => value,
None => {
crate::debug::error!("Invalid translate: fail to decode old value");
log::error!("Invalid translate: fail to decode old value");
continue
},
};
@@ -401,7 +401,7 @@ impl<
let key1 = match K1::decode(&mut key_material) {
Ok(key1) => key1,
Err(_) => {
crate::debug::error!("Invalid translate: fail to decode key1");
log::error!("Invalid translate: fail to decode key1");
continue
},
};
@@ -410,7 +410,7 @@ impl<
let key2 = match K2::decode(&mut key2_material) {
Ok(key2) => key2,
Err(_) => {
crate::debug::error!("Invalid translate: fail to decode key2");
log::error!("Invalid translate: fail to decode key2");
continue
},
};
@@ -172,7 +172,7 @@ impl<
let value = match unhashed::get::<O>(&previous_key) {
Some(value) => value,
None => {
crate::debug::error!("Invalid translate: fail to decode old value");
log::error!("Invalid translate: fail to decode old value");
continue
},
};
@@ -181,7 +181,7 @@ impl<
let key = match K::decode(&mut key_material) {
Ok(key) => key,
Err(_) => {
crate::debug::error!("Invalid translate: fail to decode key");
log::error!("Invalid translate: fail to decode key");
continue
},
};