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
@@ -45,6 +45,7 @@ use crate::{
justification::GrandpaJustification,
notification::GrandpaJustificationSender,
AuthoritySetChanges, ClientForGrandpa, CommandOrError, Error, NewAuthoritySet, VoterCommand,
LOG_TARGET,
};
/// A block-import handler for GRANDPA.
@@ -589,18 +590,16 @@ where
Ok(ImportResult::Imported(aux)) => aux,
Ok(r) => {
debug!(
target: "afg",
"Restoring old authority set after block import result: {:?}",
r,
target: LOG_TARGET,
"Restoring old authority set after block import result: {:?}", r,
);
pending_changes.revert();
return Ok(r)
},
Err(e) => {
debug!(
target: "afg",
"Restoring old authority set after block import error: {}",
e,
target: LOG_TARGET,
"Restoring old authority set after block import error: {}", e,
);
pending_changes.revert();
return Err(ConsensusError::ClientImport(e.to_string()))
@@ -665,7 +664,7 @@ where
import_res.unwrap_or_else(|err| {
if needs_justification {
debug!(
target: "afg",
target: LOG_TARGET,
"Requesting justification from peers due to imported block #{} that enacts authority set change with invalid justification: {}",
number,
err
@@ -678,7 +677,7 @@ where
None =>
if needs_justification {
debug!(
target: "afg",
target: LOG_TARGET,
"Imported unjustified block #{} that enacts authority set change, waiting for finality for enactment.",
number,
);
@@ -803,7 +802,7 @@ where
match result {
Err(CommandOrError::VoterCommand(command)) => {
afg_log!(
grandpa_log!(
initial_sync,
"👴 Imported justification for block #{} that triggers \
command {}, signaling voter.",