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
+8 -26
View File
@@ -41,7 +41,7 @@ use std::{
time::Duration,
};
use crate::{PowAlgorithm, PowIntermediate, Seal, INTERMEDIATE_KEY, POW_ENGINE_ID};
use crate::{PowAlgorithm, PowIntermediate, Seal, INTERMEDIATE_KEY, LOG_TARGET, POW_ENGINE_ID};
/// Mining metadata. This is the information needed to start an actual mining loop.
#[derive(Clone, Eq, PartialEq)]
@@ -159,26 +159,16 @@ where
) {
Ok(true) => (),
Ok(false) => {
warn!(
target: "pow",
"Unable to import mined block: seal is invalid",
);
warn!(target: LOG_TARGET, "Unable to import mined block: seal is invalid",);
return false
},
Err(err) => {
warn!(
target: "pow",
"Unable to import mined block: {}",
err,
);
warn!(target: LOG_TARGET, "Unable to import mined block: {}", err,);
return false
},
}
} else {
warn!(
target: "pow",
"Unable to import mined block: metadata does not exist",
);
warn!(target: LOG_TARGET, "Unable to import mined block: metadata does not exist",);
return false
}
@@ -192,10 +182,7 @@ where
} {
build
} else {
warn!(
target: "pow",
"Unable to import mined block: build does not exist",
);
warn!(target: LOG_TARGET, "Unable to import mined block: build does not exist",);
return false
};
@@ -225,18 +212,13 @@ where
);
info!(
target: "pow",
"✅ Successfully mined block on top of: {}",
build.metadata.best_hash
target: LOG_TARGET,
"✅ Successfully mined block on top of: {}", build.metadata.best_hash
);
true
},
Err(err) => {
warn!(
target: "pow",
"Unable to import mined block: {}",
err,
);
warn!(target: LOG_TARGET, "Unable to import mined block: {}", err,);
false
},
}