Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use frame_support::logs APIs #1326

Merged
merged 9 commits into from
Nov 7, 2024
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions crates/humanode-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ sp-runtime = { workspace = true }
sp-session = { workspace = true }
sp-staking = { workspace = true }
sp-std = { workspace = true }
sp-tracing = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
static_assertions = { workspace = true }
Expand Down Expand Up @@ -224,7 +223,6 @@ std = [
"sp-session/std",
"sp-staking/std",
"sp-std/std",
"sp-tracing/std",
"sp-transaction-pool/std",
"sp-version/std",
"substrate-wasm-builder",
Expand Down
8 changes: 0 additions & 8 deletions crates/humanode-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1597,14 +1597,6 @@ impl_runtime_apis! {
signature_check: bool,
select: frame_try_runtime::TryStateSelect
) -> Weight {
sp_tracing::info!(
target: "humanode-runtime",
"try-runtime: executing block {:?} / root checks: {:?} / signature check: {:?} / try-state-select: {:?}",
block.header.hash(),
state_root_check,
signature_check,
select,
);
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here.
Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ frame-support = { workspace = true }
frame-system = { workspace = true }
scale-info = { workspace = true, features = ["derive"] }
sp-std = { workspace = true }
sp-tracing = { workspace = true }

[dev-dependencies]
pallet-pot = { path = "../pallet-pot", default-features = false }
Expand All @@ -29,7 +28,6 @@ std = [
"scale-info/std",
"sp-core/std",
"sp-std/std",
"sp-tracing/std",
]
try-runtime = [
"frame-support/try-runtime",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Initialization of the bridge pot accounts on runtime upgrade.

use frame_support::pallet_prelude::*;
use frame_support::{log, pallet_prelude::*};
#[cfg(feature = "try-runtime")]
use sp_std::vec::Vec;

Expand All @@ -23,7 +23,7 @@ pub fn on_runtime_upgrade<T: Config>() -> Weight {
if is_version_mismatch || is_forced {
match Pallet::<T>::initialize() {
Ok(w) => weight.saturating_accrue(w),
Err(err) => sp_tracing::error!("error during bridges initialization: {err:?}"),
Err(err) => log::error!("error during bridges initialization: {err:?}"),
}

<LastInitializerVersion<T>>::put(CURRENT_BRIDGES_INITIALIZER_VERSION);
Expand Down
6 changes: 3 additions & 3 deletions crates/pallet-bioauth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl<BeforeHookData> AfterAuthHook<BeforeHookData> for () {
#[frame_support::pallet]
pub mod pallet {
use codec::MaxEncodedLen;
use frame_support::{pallet_prelude::*, sp_tracing, storage::types::ValueQuery, BoundedVec};
use frame_support::{log, pallet_prelude::*, storage::types::ValueQuery, BoundedVec};
use frame_system::pallet_prelude::*;
use sp_runtime::{
app_crypto::MaybeHash,
Expand Down Expand Up @@ -625,7 +625,7 @@ pub mod pallet {

let auth_ticket =
Self::extract_auth_ticket_checked(transaction.clone()).map_err(|error| {
sp_tracing::error!(message = "Auth Ticket could not be extracted", ?error);
log::error!("Auth Ticket could not be extracted: {error:?}");
// Use bad proof error code, as the extraction.
TransactionValidityError::Invalid(match error {
AuthTicketExtractionError::UnableToValidateSignature
Expand All @@ -647,7 +647,7 @@ pub mod pallet {
&auth_ticket,
)
.map_err(|err| {
sp_tracing::error!(message = "Authentication attemption failed", error = ?err);
log::error!("Authentication attemption failed: {err:?}");

TransactionValidityError::Invalid(match err {
AuthenticationAttemptValidationError::NonceConflict => {
Expand Down
2 changes: 1 addition & 1 deletion crates/pallet-erc20-support/src/migrations/v1.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Migration to Version 1.

use frame_support::{sp_tracing::info, traits::Get, weights::Weight};
use frame_support::{log::info, traits::Get, weights::Weight};

use crate::BalanceOf;
use crate::{Approvals, Config};
Expand Down
6 changes: 3 additions & 3 deletions crates/pallet-humanode-session/src/migrations/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use frame_support::pallet_prelude::*;
use frame_support::storage_alias;
use frame_support::{dispatch::GetStorageVersion, sp_tracing::info, traits::Get, weights::Weight};
use frame_support::{dispatch::GetStorageVersion, log::info, traits::Get, weights::Weight};
#[cfg(feature = "try-runtime")]
use sp_std::{vec, vec::Vec};

Expand All @@ -27,10 +27,10 @@ pub fn migrate<T: Config>() -> Weight {
// Read the onchain version.
let mut weight: Weight = T::DbWeight::get().reads(1);

info!(message = "Running migration to v1", from = ?onchain);
info!("Running migration to v1 from {onchain:?}");

if onchain == 1 {
info!(message = "Already at version 1, nothing to do");
info!("Already at version 1, nothing to do");
return weight;
}

Expand Down
5 changes: 1 addition & 4 deletions crates/primitives-currency-swap-proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ where
incoming_imbalance,
}) => {
let error: frame_support::sp_runtime::DispatchError = error.into();
frame_support::sp_tracing::error!(
message = "unable to route the funds through the swap",
?error
);
frame_support::log::error!("unable to route the funds through the swap: {error:?}");
Fallback::on_unbalanceds(sp_std::iter::once(incoming_imbalance));
return;
}
Expand Down