From e22e449c4ae6bb208d2cc731adef54d1459a3126 Mon Sep 17 00:00:00 2001 From: Just van Stam <vstam1@users.noreply.github.com> Date: Tue, 2 May 2023 16:22:34 +0200 Subject: [PATCH] fix log targets for nonfungibles-adapter (#7154) * fix log targets for nonfungibles-adapter * change target * make const for LOG_TARGET and fmt --- .../xcm-builder/src/nonfungibles_adapter.rs | 45 +++++++++++++------ 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/polkadot/xcm/xcm-builder/src/nonfungibles_adapter.rs b/polkadot/xcm/xcm-builder/src/nonfungibles_adapter.rs index 530f84949e5..0becb2608b4 100644 --- a/polkadot/xcm/xcm-builder/src/nonfungibles_adapter.rs +++ b/polkadot/xcm/xcm-builder/src/nonfungibles_adapter.rs @@ -25,6 +25,8 @@ use sp_std::{marker::PhantomData, prelude::*, result}; use xcm::latest::prelude::*; use xcm_executor::traits::{Convert, Error as MatchError, MatchesNonFungibles, TransactAsset}; +const LOG_TARGET: &str = "xcm::nonfungibles_adapter"; + pub struct NonFungiblesTransferAdapter<Assets, Matcher, AccountIdConverter, AccountId>( PhantomData<(Assets, Matcher, AccountIdConverter, AccountId)>, ); @@ -42,9 +44,12 @@ impl< context: &XcmContext, ) -> result::Result<xcm_executor::Assets, XcmError> { log::trace!( - target: "xcm::non_fungibles_adapter", + target: LOG_TARGET, "transfer_asset what: {:?}, from: {:?}, to: {:?}, context: {:?}", - what, from, to, context, + what, + from, + to, + context, ); // Check we handle this asset. let (class, instance) = Matcher::matches_nonfungibles(what)?; @@ -126,9 +131,11 @@ impl< { fn can_check_in(_origin: &MultiLocation, what: &MultiAsset, context: &XcmContext) -> XcmResult { log::trace!( - target: "xcm::fungibles_adapter", + target: LOG_TARGET, "can_check_in origin: {:?}, what: {:?}, context: {:?}", - _origin, what, context, + _origin, + what, + context, ); // Check we handle this asset. let (class, instance) = Matcher::matches_nonfungibles(what)?; @@ -143,9 +150,11 @@ impl< fn check_in(_origin: &MultiLocation, what: &MultiAsset, context: &XcmContext) { log::trace!( - target: "xcm::fungibles_adapter", + target: LOG_TARGET, "check_in origin: {:?}, what: {:?}, context: {:?}", - _origin, what, context, + _origin, + what, + context, ); if let Ok((class, instance)) = Matcher::matches_nonfungibles(what) { match CheckAsset::asset_checking(&class) { @@ -160,9 +169,11 @@ impl< fn can_check_out(_dest: &MultiLocation, what: &MultiAsset, context: &XcmContext) -> XcmResult { log::trace!( - target: "xcm::fungibles_adapter", + target: LOG_TARGET, "can_check_out dest: {:?}, what: {:?}, context: {:?}", - _dest, what, context, + _dest, + what, + context, ); // Check we handle this asset. let (class, instance) = Matcher::matches_nonfungibles(what)?; @@ -177,9 +188,11 @@ impl< fn check_out(_dest: &MultiLocation, what: &MultiAsset, context: &XcmContext) { log::trace!( - target: "xcm::fungibles_adapter", + target: LOG_TARGET, "check_out dest: {:?}, what: {:?}, context: {:?}", - _dest, what, context, + _dest, + what, + context, ); if let Ok((class, instance)) = Matcher::matches_nonfungibles(what) { match CheckAsset::asset_checking(&class) { @@ -194,9 +207,11 @@ impl< fn deposit_asset(what: &MultiAsset, who: &MultiLocation, context: &XcmContext) -> XcmResult { log::trace!( - target: "xcm::fungibles_adapter", + target: LOG_TARGET, "deposit_asset what: {:?}, who: {:?}, context: {:?}", - what, who, context, + what, + who, + context, ); // Check we handle this asset. let (class, instance) = Matcher::matches_nonfungibles(what)?; @@ -212,9 +227,11 @@ impl< maybe_context: Option<&XcmContext>, ) -> result::Result<xcm_executor::Assets, XcmError> { log::trace!( - target: "xcm::fungibles_adapter", + target: LOG_TARGET, "withdraw_asset what: {:?}, who: {:?}, maybe_context: {:?}", - what, who, maybe_context, + what, + who, + maybe_context, ); // Check we handle this asset. let who = AccountIdConverter::convert_ref(who) -- GitLab