Use LOG_TARGET in consensus related crates (#12875)

* Use shared LOG_TARGET in consensus related crates
* Rename target from "afg" to "grandpa"
This commit is contained in:
Davide Galassi
2022-12-14 14:56:17 +01:00
committed by GitHub
parent 3e0a1904b7
commit 391adaf443
31 changed files with 343 additions and 247 deletions
@@ -29,7 +29,7 @@ use sc_consensus::shared_data::{SharedData, SharedDataLocked};
use sc_telemetry::{telemetry, TelemetryHandle, CONSENSUS_INFO};
use sp_finality_grandpa::{AuthorityId, AuthorityList};
use crate::SetId;
use crate::{SetId, LOG_TARGET};
/// Error type returned on operations on the `AuthoritySet`.
#[derive(Debug, thiserror::Error)]
@@ -314,7 +314,7 @@ where
let number = pending.canon_height.clone();
debug!(
target: "afg",
target: LOG_TARGET,
"Inserting potential standard set change signaled at block {:?} (delayed by {:?} blocks).",
(&number, &hash),
pending.delay,
@@ -323,7 +323,7 @@ where
self.pending_standard_changes.import(hash, number, pending, is_descendent_of)?;
debug!(
target: "afg",
target: LOG_TARGET,
"There are now {} alternatives for the next pending standard change (roots), and a \
total of {} pending standard changes (across all forks).",
self.pending_standard_changes.roots().count(),
@@ -362,7 +362,7 @@ where
.unwrap_or_else(|i| i);
debug!(
target: "afg",
target: LOG_TARGET,
"Inserting potential forced set change at block {:?} (delayed by {:?} blocks).",
(&pending.canon_height, &pending.canon_hash),
pending.delay,
@@ -370,7 +370,11 @@ where
self.pending_forced_changes.insert(idx, pending);
debug!(target: "afg", "There are now {} pending forced changes.", self.pending_forced_changes.len());
debug!(
target: LOG_TARGET,
"There are now {} pending forced changes.",
self.pending_forced_changes.len()
);
Ok(())
}
@@ -475,7 +479,7 @@ where
if standard_change.effective_number() <= median_last_finalized &&
is_descendent_of(&standard_change.canon_hash, &change.canon_hash)?
{
log::info!(target: "afg",
log::info!(target: LOG_TARGET,
"Not applying authority set change forced at block #{:?}, due to pending standard change at block #{:?}",
change.canon_height,
standard_change.effective_number(),
@@ -488,7 +492,7 @@ where
}
// apply this change: make the set canonical
afg_log!(
grandpa_log!(
initial_sync,
"👴 Applying authority set change forced at block #{:?}",
change.canon_height,
@@ -570,7 +574,7 @@ where
}
if let Some(change) = change {
afg_log!(
grandpa_log!(
initial_sync,
"👴 Applying authority set change scheduled at block #{:?}",
change.canon_height,