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
@@ -35,7 +35,7 @@ use crate::{
buffered_link::{self, BufferedLinkReceiver, BufferedLinkSender},
import_single_block_metered, BlockImportError, BlockImportStatus, BoxBlockImport,
BoxJustificationImport, ImportQueue, ImportQueueService, IncomingBlock, Link,
RuntimeOrigin, Verifier,
RuntimeOrigin, Verifier, LOG_TARGET,
},
metrics::Metrics,
};
@@ -129,14 +129,14 @@ impl<B: BlockT> ImportQueueService<B> for BasicQueueHandle<B> {
return
}
trace!(target: "sync", "Scheduling {} blocks for import", blocks.len());
trace!(target: LOG_TARGET, "Scheduling {} blocks for import", blocks.len());
let res = self
.block_import_sender
.unbounded_send(worker_messages::ImportBlocks(origin, blocks));
if res.is_err() {
log::error!(
target: "sync",
target: LOG_TARGET,
"import_blocks: Background import task is no longer alive"
);
}
@@ -156,7 +156,7 @@ impl<B: BlockT> ImportQueueService<B> for BasicQueueHandle<B> {
if res.is_err() {
log::error!(
target: "sync",
target: LOG_TARGET,
"import_justification: Background import task is no longer alive"
);
}
@@ -179,7 +179,10 @@ impl<B: BlockT, Transaction: Send> ImportQueue<B> for BasicQueue<B, Transaction>
/// Poll actions from network.
fn poll_actions(&mut self, cx: &mut Context, link: &mut dyn Link<B>) {
if self.result_port.poll_actions(cx, link).is_err() {
log::error!(target: "sync", "poll_actions: Background import task is no longer alive");
log::error!(
target: LOG_TARGET,
"poll_actions: Background import task is no longer alive"
);
}
}
@@ -231,7 +234,7 @@ async fn block_import_process<B: BlockT, Transaction: Send + 'static>(
Some(blocks) => blocks,
None => {
log::debug!(
target: "block-import",
target: LOG_TARGET,
"Stopping block import because the import channel was closed!",
);
return
@@ -305,7 +308,7 @@ impl<B: BlockT> BlockImportWorker<B> {
// down and we should end this future.
if worker.result_sender.is_closed() {
log::debug!(
target: "block-import",
target: LOG_TARGET,
"Stopping block import because result channel was closed!",
);
return
@@ -318,7 +321,7 @@ impl<B: BlockT> BlockImportWorker<B> {
worker.import_justification(who, hash, number, justification).await,
None => {
log::debug!(
target: "block-import",
target: LOG_TARGET,
"Stopping block import because justification channel was closed!",
);
return
@@ -353,7 +356,7 @@ impl<B: BlockT> BlockImportWorker<B> {
.await
.map_err(|e| {
debug!(
target: "sync",
target: LOG_TARGET,
"Justification import failed for hash = {:?} with number = {:?} coming from node = {:?} with error: {}",
hash,
number,
@@ -407,7 +410,7 @@ async fn import_many_blocks<B: BlockT, V: Verifier<B>, Transaction: Send + 'stat
_ => Default::default(),
};
trace!(target: "sync", "Starting import of {} blocks {}", count, blocks_range);
trace!(target: LOG_TARGET, "Starting import of {} blocks {}", count, blocks_range);
let mut imported = 0;
let mut results = vec![];
@@ -447,7 +450,7 @@ async fn import_many_blocks<B: BlockT, V: Verifier<B>, Transaction: Send + 'stat
if import_result.is_ok() {
trace!(
target: "sync",
target: LOG_TARGET,
"Block imported successfully {:?} ({})",
block_number,
block_hash,