diff --git a/client/consensus/aura/src/import_queue.rs b/client/consensus/aura/src/import_queue.rs
index 07f982542c95b..d5cf40f33359e 100644
--- a/client/consensus/aura/src/import_queue.rs
+++ b/client/consensus/aura/src/import_queue.rs
@@ -20,6 +20,7 @@
use crate::{
aura_err, authorities, find_pre_digest, slot_author, AuthorityId, CompatibilityMode, Error,
+ LOG_TARGET,
};
use codec::{Codec, Decode, Encode};
use log::{debug, info, trace};
@@ -88,7 +89,7 @@ where
.map_err(Error::Client)?
{
info!(
- target: "aura",
+ target: LOG_TARGET,
"Slot author is equivocating at slot {} with headers {:?} and {:?}",
slot,
equivocation_proof.first_header.hash(),
@@ -256,7 +257,7 @@ where
block.body = Some(inner_body);
}
- trace!(target: "aura", "Checked {:?}; importing.", pre_header);
+ trace!(target: LOG_TARGET, "Checked {:?}; importing.", pre_header);
telemetry!(
self.telemetry;
CONSENSUS_TRACE;
@@ -272,7 +273,7 @@ where
Ok((block, None))
},
CheckedHeader::Deferred(a, b) => {
- debug!(target: "aura", "Checking {:?} failed; {:?}, {:?}.", hash, a, b);
+ debug!(target: LOG_TARGET, "Checking {:?} failed; {:?}, {:?}.", hash, a, b);
telemetry!(
self.telemetry;
CONSENSUS_DEBUG;
diff --git a/client/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs
index 46b9124f9077f..a8ed80d7c0432 100644
--- a/client/consensus/aura/src/lib.rs
+++ b/client/consensus/aura/src/lib.rs
@@ -72,6 +72,8 @@ pub use sp_consensus_aura::{
AuraApi, ConsensusLog, SlotDuration, AURA_ENGINE_ID,
};
+const LOG_TARGET: &str = "aura";
+
type AuthorityId
=
::Public;
/// Run `AURA` in a compatibility mode.
@@ -530,7 +532,7 @@ where
}
fn aura_err(error: Error) -> Error {
- debug!(target: "aura", "{}", error);
+ debug!(target: LOG_TARGET, "{}", error);
error
}
@@ -580,10 +582,10 @@ pub fn find_pre_digest(header: &B::Header) -> Resul
let mut pre_digest: Option = None;
for log in header.digest().logs() {
- trace!(target: "aura", "Checking log {:?}", log);
+ trace!(target: LOG_TARGET, "Checking log {:?}", log);
match (CompatibleDigestItem::::as_aura_pre_digest(log), pre_digest.is_some()) {
(Some(_), true) => return Err(aura_err(Error::MultipleHeaders)),
- (None, _) => trace!(target: "aura", "Ignoring digest not meant for us"),
+ (None, _) => trace!(target: LOG_TARGET, "Ignoring digest not meant for us"),
(s, false) => pre_digest = s,
}
}
diff --git a/client/consensus/babe/src/aux_schema.rs b/client/consensus/babe/src/aux_schema.rs
index fef84bda86974..2a09aa738f4ec 100644
--- a/client/consensus/babe/src/aux_schema.rs
+++ b/client/consensus/babe/src/aux_schema.rs
@@ -21,7 +21,7 @@
use codec::{Decode, Encode};
use log::info;
-use crate::{migration::EpochV0, Epoch};
+use crate::{migration::EpochV0, Epoch, LOG_TARGET};
use sc_client_api::backend::AuxStore;
use sc_consensus_epochs::{
migration::{EpochChangesV0For, EpochChangesV1For},
@@ -82,7 +82,7 @@ pub fn load_epoch_changes(
let epoch_changes =
SharedEpochChanges::::new(maybe_epoch_changes.unwrap_or_else(|| {
info!(
- target: "babe",
+ target: LOG_TARGET,
"👶 Creating empty BABE epoch changes on what appears to be first startup.",
);
EpochChangesFor::::default()
diff --git a/client/consensus/babe/src/lib.rs b/client/consensus/babe/src/lib.rs
index 84b6893648f49..b50874ae3401d 100644
--- a/client/consensus/babe/src/lib.rs
+++ b/client/consensus/babe/src/lib.rs
@@ -149,6 +149,8 @@ pub mod aux_schema;
#[cfg(test)]
mod tests;
+const LOG_TARGET: &str = "babe";
+
/// BABE epoch information
#[derive(Decode, Encode, PartialEq, Eq, Clone, Debug)]
pub struct Epoch {
@@ -323,7 +325,7 @@ impl From> for String {
}
fn babe_err(error: Error) -> Error {
- debug!(target: "babe", "{}", error);
+ debug!(target: LOG_TARGET, "{}", error);
error
}
@@ -345,7 +347,7 @@ where
let block_id = if client.usage_info().chain.finalized_state.is_some() {
BlockId::Hash(client.usage_info().chain.best_hash)
} else {
- debug!(target: "babe", "No finalized state is available. Reading config from genesis");
+ debug!(target: LOG_TARGET, "No finalized state is available. Reading config from genesis");
BlockId::Hash(client.usage_info().chain.genesis_hash)
};
@@ -486,7 +488,7 @@ where
telemetry,
};
- info!(target: "babe", "👶 Starting BABE Authorship worker");
+ info!(target: LOG_TARGET, "👶 Starting BABE Authorship worker");
let slot_worker = sc_consensus_slots::start_slot_worker(
babe_link.config.slot_duration(),
@@ -523,12 +525,8 @@ fn aux_storage_cleanup + HeaderBackend, Block: B
Ok(meta) => {
hashes.insert(meta.parent);
},
- Err(err) => warn!(
- target: "babe",
- "Failed to lookup metadata for block `{:?}`: {}",
- first,
- err,
- ),
+ Err(err) =>
+ warn!(target: LOG_TARGET, "Failed to lookup metadata for block `{:?}`: {}", first, err,),
}
// Cleans data for finalized block's ancestors
@@ -716,7 +714,7 @@ where
type AuxData = ViableEpochDescriptor, Epoch>;
fn logging_target(&self) -> &'static str {
- "babe"
+ LOG_TARGET
}
fn block_import(&mut self) -> &mut Self::BlockImport {
@@ -749,7 +747,7 @@ where
slot: Slot,
epoch_descriptor: &ViableEpochDescriptor, Epoch>,
) -> Option {
- debug!(target: "babe", "Attempting to claim slot {}", slot);
+ debug!(target: LOG_TARGET, "Attempting to claim slot {}", slot);
let s = authorship::claim_slot(
slot,
self.epoch_changes
@@ -760,7 +758,7 @@ where
);
if s.is_some() {
- debug!(target: "babe", "Claimed slot {}", slot);
+ debug!(target: LOG_TARGET, "Claimed slot {}", slot);
}
s
@@ -777,7 +775,7 @@ where
Ok(()) => true,
Err(e) =>
if e.is_full() {
- warn!(target: "babe", "Trying to notify a slot but the channel is full");
+ warn!(target: LOG_TARGET, "Trying to notify a slot but the channel is full");
true
} else {
false
@@ -904,10 +902,10 @@ pub fn find_pre_digest(header: &B::Header) -> Result = None;
for log in header.digest().logs() {
- trace!(target: "babe", "Checking log {:?}, looking for pre runtime digest", log);
+ trace!(target: LOG_TARGET, "Checking log {:?}, looking for pre runtime digest", log);
match (log.as_babe_pre_digest(), pre_digest.is_some()) {
(Some(_), true) => return Err(babe_err(Error::MultiplePreRuntimeDigests)),
- (None, _) => trace!(target: "babe", "Ignoring digest not meant for us"),
+ (None, _) => trace!(target: LOG_TARGET, "Ignoring digest not meant for us"),
(s, false) => pre_digest = s,
}
}
@@ -920,13 +918,13 @@ fn find_next_epoch_digest(
) -> Result