Companion for init the RuntimeLogger automatically (#2522)

* Lol

* Add the features

* Remove some more runtime logger init calls

* Make companion check work

* Revert "Make companion check work"

This reverts commit a255c798076466c0fa20a4db713fc712772c2b4d.

* Update Substrate
This commit is contained in:
Bastian Köcher
2021-03-01 16:15:34 +01:00
committed by GitHub
parent 135cce9055
commit 7a2c7aa3fe
18 changed files with 231 additions and 192 deletions
+2 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] }
parity-scale-codec = { version = "2.0.0", default-features = false, features = ["derive"] }
log = "0.4.13"
log = { version = "0.4.14", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false }
serde = { version = "1.0.123", features = [ "derive" ], optional = true }
derive_more = "0.99.11"
@@ -86,6 +86,7 @@ std = [
"pallet-vesting/std",
"xcm/std",
"xcm-executor/std",
"log/std",
]
runtime-benchmarks = [
"libsecp256k1/hmac",
+8 -10
View File
@@ -28,8 +28,8 @@ use primitives::v1::{
CandidateReceipt, HeadData, CandidateHash, Hash,
};
use frame_support::{
decl_storage, decl_module, decl_error, decl_event, ensure, debug,
dispatch::DispatchResult, IterableStorageMap, weights::Weight, traits::Get,
decl_storage, decl_module, decl_error, decl_event, ensure, dispatch::DispatchResult, IterableStorageMap,
weights::Weight, traits::Get,
};
use parity_scale_codec::{Encode, Decode};
use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec};
@@ -213,7 +213,7 @@ decl_module! {
}
}
const LOG_TARGET: &str = "parachains_runtime_inclusion";
const LOG_TARGET: &str = "runtime::inclusion";
impl<T: Config> Module<T> {
/// Block initialization logic, called by initializer.
@@ -343,11 +343,11 @@ impl<T: Config> Module<T> {
let commitments = match PendingAvailabilityCommitments::take(&para_id) {
Some(commitments) => commitments,
None => {
debug::warn!(r#"
Inclusion::process_bitfields:
PendingAvailability and PendingAvailabilityCommitments
are out of sync, did someone mess with the storage?
"#);
log::warn!(
target: LOG_TARGET,
"Inclusion::process_bitfields: PendingAvailability and PendingAvailabilityCommitments
are out of sync, did someone mess with the storage?",
);
continue;
}
};
@@ -460,7 +460,6 @@ impl<T: Config> Module<T> {
&candidate.candidate.commitments.horizontal_messages,
)
{
frame_support::debug::RuntimeLogger::init();
log::debug!(
target: LOG_TARGET,
"Validation outputs checking during inclusion of a candidate {} for parachain `{}` failed: {:?}",
@@ -631,7 +630,6 @@ impl<T: Config> Module<T> {
T::BlockNumber::from(validation_outputs.hrmp_watermark),
&validation_outputs.horizontal_messages,
) {
frame_support::debug::RuntimeLogger::init();
log::debug!(
target: LOG_TARGET,
"Validation outputs checking for parachain `{}` failed: {:?}",
@@ -227,8 +227,7 @@ impl<T: Config> ProvideInherent for Module<T> {
) {
Ok(_) => (signed_bitfields, backed_candidates),
Err(err) => {
frame_support::debug::RuntimeLogger::init();
frame_support::debug::warn!(
log::warn!(
target: "runtime_inclusion_inherent",
"dropping signed_bitfields and backed_candidates because they produced \
an invalid inclusion inherent: {:?}",
@@ -27,7 +27,6 @@ use primitives::v1::{
GroupIndex, CandidateEvent, PersistedValidationData, SessionInfo,
InboundDownwardMessage, InboundHrmpMessage, Hash, AuthorityDiscoveryId
};
use frame_support::debug;
use crate::{initializer, inclusion, scheduler, configuration, paras, session_info, dmp, hrmp, shared};
@@ -85,8 +84,11 @@ pub fn availability_cores<T: initializer::Config>() -> Vec<CoreState<T::Hash, T:
match <scheduler::Module<T>>::group_assigned_to_core(core_index, backed_in_number) {
Some(g) => g,
None => {
debug::warn!("Could not determine the group responsible for core extracted \
from list of cores for some prior block in same session");
log::warn!(
target: "runtime::polkadot-api::v1",
"Could not determine the group responsible for core extracted \
from list of cores for some prior block in same session",
);
GroupIndex(0)
}
+2 -2
View File
@@ -75,8 +75,8 @@ impl<Config: xcm_executor::Config> UmpSink for XcmSink<Config> {
}
}
} else {
frame_support::debug::error!(
target: "xcm",
log::error!(
target: "runtime::ump-sink",
"Failed to decode versioned XCM from upward message.",
);
}