Skip to content

Commit

Permalink
migrate log to tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayevbeosa Iyamu committed Dec 10, 2024
1 parent 5e0bcb0 commit 7b32c89
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 85 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

4 changes: 2 additions & 2 deletions polkadot/xcm/xcm-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ frame-support = { workspace = true }
frame-system = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-asset-conversion = { workspace = true }
log = { workspace = true }
tracing = { workspace = true }

# Polkadot dependencies
polkadot-parachain-primitives = { workspace = true }
Expand Down Expand Up @@ -62,7 +62,7 @@ std = [
"codec/std",
"frame-support/std",
"frame-system/std",
"log/std",
"tracing/std",
"pallet-asset-conversion/std",
"pallet-transaction-payment/std",
"polkadot-parachain-primitives/std",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ where
) -> Result<AssetsInHolding, AssetsInHolding> {
let mut give_iter = give.fungible_assets_iter();
let give_asset = give_iter.next().ok_or_else(|| {
log::trace!(
tracing::trace!(
target: "xcm::SingleAssetExchangeAdapter::exchange_asset",
"No fungible asset was in `give`.",
);
Expand All @@ -73,7 +73,7 @@ where
let want_asset = want.get(0).ok_or_else(|| give.clone())?;
let (give_asset_id, give_amount) =
Matcher::matches_fungibles(&give_asset).map_err(|error| {
log::trace!(
tracing::trace!(
target: "xcm::SingleAssetExchangeAdapter::exchange_asset",
"Could not map XCM asset give {:?} to FRAME asset. Error: {:?}",
give_asset,
Expand All @@ -83,7 +83,7 @@ where
})?;
let (want_asset_id, want_amount) =
Matcher::matches_fungibles(&want_asset).map_err(|error| {
log::trace!(
tracing::trace!(
target: "xcm::SingleAssetExchangeAdapter::exchange_asset",
"Could not map XCM asset want {:?} to FRAME asset. Error: {:?}",
want_asset,
Expand All @@ -106,7 +106,7 @@ where
Some(want_amount),
)
.map_err(|(credit_in, error)| {
log::error!(
tracing::error!(
target: "xcm::SingleAssetExchangeAdapter::exchange_asset",
"Could not perform the swap, error: {:?}.",
error
Expand All @@ -127,7 +127,7 @@ where
want_amount,
)
.map_err(|(credit_in, error)| {
log::error!(
tracing::error!(
target: "xcm::SingleAssetExchangeAdapter::exchange_asset",
"Could not perform the swap, error: {:?}.",
error
Expand Down Expand Up @@ -162,7 +162,7 @@ where
// We first match both XCM assets to the asset ID types `AssetConversion` can handle.
let (give_asset_id, give_amount) = Matcher::matches_fungibles(give_asset)
.map_err(|error| {
log::trace!(
tracing::trace!(
target: "xcm::SingleAssetExchangeAdapter::quote_exchange_price",
"Could not map XCM asset {:?} to FRAME asset. Error: {:?}.",
give_asset,
Expand All @@ -173,7 +173,7 @@ where
.ok()?;
let (want_asset_id, want_amount) = Matcher::matches_fungibles(want_asset)
.map_err(|error| {
log::trace!(
tracing::trace!(
target: "xcm::SingleAssetExchangeAdapter::quote_exchange_price",
"Could not map XCM asset {:?} to FRAME asset. Error: {:?}.",
want_asset,
Expand Down
20 changes: 10 additions & 10 deletions polkadot/xcm/xcm-builder/src/barriers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl ShouldExecute for TakeWeightCredit {
max_weight: Weight,
properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
log::trace!(
tracing::trace!(
target: "xcm::barriers",
"TakeWeightCredit origin: {:?}, instructions: {:?}, max_weight: {:?}, properties: {:?}",
_origin, _instructions, max_weight, properties,
Expand Down Expand Up @@ -68,7 +68,7 @@ impl<T: Contains<Location>> ShouldExecute for AllowTopLevelPaidExecutionFrom<T>
max_weight: Weight,
_properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
log::trace!(
tracing::trace!(
target: "xcm::barriers",
"AllowTopLevelPaidExecutionFrom origin: {:?}, instructions: {:?}, max_weight: {:?}, properties: {:?}",
origin, instructions, max_weight, _properties,
Expand Down Expand Up @@ -172,7 +172,7 @@ impl<InnerBarrier: ShouldExecute, LocalUniversal: Get<InteriorLocation>, MaxPref
max_weight: Weight,
properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
log::trace!(
tracing::trace!(
target: "xcm::barriers",
"WithComputedOrigin origin: {:?}, instructions: {:?}, max_weight: {:?}, properties: {:?}",
origin, instructions, max_weight, properties,
Expand Down Expand Up @@ -229,7 +229,7 @@ impl<InnerBarrier: ShouldExecute> ShouldExecute for TrailingSetTopicAsId<InnerBa
max_weight: Weight,
properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
log::trace!(
tracing::trace!(
target: "xcm::barriers",
"TrailingSetTopicAsId origin: {:?}, instructions: {:?}, max_weight: {:?}, properties: {:?}",
origin, instructions, max_weight, properties,
Expand Down Expand Up @@ -278,7 +278,7 @@ impl<T: Contains<Location>> ShouldExecute for AllowUnpaidExecutionFrom<T> {
_max_weight: Weight,
_properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
log::trace!(
tracing::trace!(
target: "xcm::barriers",
"AllowUnpaidExecutionFrom origin: {:?}, instructions: {:?}, max_weight: {:?}, properties: {:?}",
origin, instructions, _max_weight, _properties,
Expand All @@ -300,7 +300,7 @@ impl<T: Contains<Location>> ShouldExecute for AllowExplicitUnpaidExecutionFrom<T
max_weight: Weight,
_properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
log::trace!(
tracing::trace!(
target: "xcm::barriers",
"AllowExplicitUnpaidExecutionFrom origin: {:?}, instructions: {:?}, max_weight: {:?}, properties: {:?}",
origin, instructions, max_weight, _properties,
Expand Down Expand Up @@ -359,7 +359,7 @@ impl<ResponseHandler: OnResponse> ShouldExecute for AllowKnownQueryResponses<Res
_max_weight: Weight,
_properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
log::trace!(
tracing::trace!(
target: "xcm::barriers",
"AllowKnownQueryResponses origin: {:?}, instructions: {:?}, max_weight: {:?}, properties: {:?}",
origin, instructions, _max_weight, _properties,
Expand Down Expand Up @@ -387,7 +387,7 @@ impl<T: Contains<Location>> ShouldExecute for AllowSubscriptionsFrom<T> {
_max_weight: Weight,
_properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
log::trace!(
tracing::trace!(
target: "xcm::barriers",
"AllowSubscriptionsFrom origin: {:?}, instructions: {:?}, max_weight: {:?}, properties: {:?}",
origin, instructions, _max_weight, _properties,
Expand Down Expand Up @@ -418,7 +418,7 @@ impl ShouldExecute for AllowHrmpNotificationsFromRelayChain {
_max_weight: Weight,
_properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
log::trace!(
tracing::trace!(
target: "xcm::barriers",
"AllowHrmpNotificationsFromRelayChain origin: {:?}, instructions: {:?}, max_weight: {:?}, properties: {:?}",
origin, instructions, _max_weight, _properties,
Expand Down Expand Up @@ -488,7 +488,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain {
ReserveAssetDeposited { .. }
if matches!(origin, Location { parents: 1, interior: Here }) =>
{
log::warn!(
tracing::warn!(
target: "xcm::barrier",
"Unexpected ReserveAssetDeposited from the Relay Chain",
);
Expand Down
14 changes: 7 additions & 7 deletions polkadot/xcm/xcm-builder/src/currency_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl<
for CurrencyAdapter<Currency, Matcher, AccountIdConverter, AccountId, CheckedAccount>
{
fn can_check_in(_origin: &Location, what: &Asset, _context: &XcmContext) -> Result {
log::trace!(target: "xcm::currency_adapter", "can_check_in origin: {:?}, what: {:?}", _origin, what);
tracing::trace!(target: "xcm::currency_adapter", "can_check_in origin: {:?}, what: {:?}", _origin, what);
// Check we handle this asset.
let amount: Currency::Balance =
Matcher::matches_fungible(what).ok_or(Error::AssetNotHandled)?;
Expand All @@ -157,7 +157,7 @@ impl<
}

fn check_in(_origin: &Location, what: &Asset, _context: &XcmContext) {
log::trace!(target: "xcm::currency_adapter", "check_in origin: {:?}, what: {:?}", _origin, what);
tracing::trace!(target: "xcm::currency_adapter", "check_in origin: {:?}, what: {:?}", _origin, what);
if let Some(amount) = Matcher::matches_fungible(what) {
match CheckedAccount::get() {
Some((checked_account, MintLocation::Local)) =>
Expand All @@ -170,7 +170,7 @@ impl<
}

fn can_check_out(_dest: &Location, what: &Asset, _context: &XcmContext) -> Result {
log::trace!(target: "xcm::currency_adapter", "can_check_out dest: {:?}, what: {:?}", _dest, what);
tracing::trace!(target: "xcm::currency_adapter", "can_check_out dest: {:?}, what: {:?}", _dest, what);
let amount = Matcher::matches_fungible(what).ok_or(Error::AssetNotHandled)?;
match CheckedAccount::get() {
Some((checked_account, MintLocation::Local)) =>
Expand All @@ -182,7 +182,7 @@ impl<
}

fn check_out(_dest: &Location, what: &Asset, _context: &XcmContext) {
log::trace!(target: "xcm::currency_adapter", "check_out dest: {:?}, what: {:?}", _dest, what);
tracing::trace!(target: "xcm::currency_adapter", "check_out dest: {:?}, what: {:?}", _dest, what);
if let Some(amount) = Matcher::matches_fungible(what) {
match CheckedAccount::get() {
Some((checked_account, MintLocation::Local)) =>
Expand All @@ -195,7 +195,7 @@ impl<
}

fn deposit_asset(what: &Asset, who: &Location, _context: Option<&XcmContext>) -> Result {
log::trace!(target: "xcm::currency_adapter", "deposit_asset what: {:?}, who: {:?}", what, who);
tracing::trace!(target: "xcm::currency_adapter", "deposit_asset what: {:?}, who: {:?}", what, who);
// Check we handle this asset.
let amount = Matcher::matches_fungible(&what).ok_or(Error::AssetNotHandled)?;
let who =
Expand All @@ -209,7 +209,7 @@ impl<
who: &Location,
_maybe_context: Option<&XcmContext>,
) -> result::Result<AssetsInHolding, XcmError> {
log::trace!(target: "xcm::currency_adapter", "withdraw_asset what: {:?}, who: {:?}", what, who);
tracing::trace!(target: "xcm::currency_adapter", "withdraw_asset what: {:?}, who: {:?}", what, who);
// Check we handle this asset.
let amount = Matcher::matches_fungible(what).ok_or(Error::AssetNotHandled)?;
let who =
Expand All @@ -225,7 +225,7 @@ impl<
to: &Location,
_context: &XcmContext,
) -> result::Result<AssetsInHolding, XcmError> {
log::trace!(target: "xcm::currency_adapter", "internal_transfer_asset asset: {:?}, from: {:?}, to: {:?}", asset, from, to);
tracing::trace!(target: "xcm::currency_adapter", "internal_transfer_asset asset: {:?}, from: {:?}, to: {:?}", asset, from, to);
let amount = Matcher::matches_fungible(asset).ok_or(Error::AssetNotHandled)?;
let from =
AccountIdConverter::convert_location(from).ok_or(Error::AccountIdConversionFailed)?;
Expand Down
2 changes: 1 addition & 1 deletion polkadot/xcm/xcm-builder/src/fee_handling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub fn deposit_or_burn_fee<AssetTransactor: TransactAsset>(
) {
for asset in fee.into_inner() {
if let Err(e) = AssetTransactor::deposit_asset(&asset, &dest, context) {
log::trace!(
tracing::trace!(
target: "xcm::fees",
"`AssetTransactor::deposit_asset` returned error: {e:?}. Burning fee: {asset:?}. \
They might be burned.",
Expand Down
6 changes: 3 additions & 3 deletions polkadot/xcm/xcm-builder/src/filter_asset_location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use xcm::latest::{Asset, AssetFilter, AssetId, Location, WildAsset};
pub struct NativeAsset;
impl ContainsPair<Asset, Location> for NativeAsset {
fn contains(asset: &Asset, origin: &Location) -> bool {
log::trace!(target: "xcm::contains", "NativeAsset asset: {:?}, origin: {:?}", asset, origin);
tracing::trace!(target: "xcm::contains", "NativeAsset asset: {:?}, origin: {:?}", asset, origin);
matches!(asset.id, AssetId(ref id) if id == origin)
}
}
Expand All @@ -35,7 +35,7 @@ impl ContainsPair<Asset, Location> for NativeAsset {
pub struct Case<T>(PhantomData<T>);
impl<T: Get<(AssetFilter, Location)>> ContainsPair<Asset, Location> for Case<T> {
fn contains(asset: &Asset, origin: &Location) -> bool {
log::trace!(target: "xcm::contains", "Case asset: {:?}, origin: {:?}", asset, origin);
tracing::trace!(target: "xcm::contains", "Case asset: {:?}, origin: {:?}", asset, origin);
let (a, o) = T::get();
a.matches(asset) && &o == origin
}
Expand All @@ -51,7 +51,7 @@ impl<LocationFilter: Contains<Location>, AssetFilters: Get<Vec<AssetFilter>>>
Contains<(Location, Vec<Asset>)> for LocationWithAssetFilters<LocationFilter, AssetFilters>
{
fn contains((location, assets): &(Location, Vec<Asset>)) -> bool {
log::trace!(target: "xcm::contains", "LocationWithAssetFilters location: {:?}, assets: {:?}", location, assets);
tracing::trace!(target: "xcm::contains", "LocationWithAssetFilters location: {:?}, assets: {:?}", location, assets);

// `location` must match the `Location` filter.
if !LocationFilter::contains(location) {
Expand Down
14 changes: 7 additions & 7 deletions polkadot/xcm/xcm-builder/src/fungible_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<
to: &Location,
_context: &XcmContext,
) -> result::Result<AssetsInHolding, XcmError> {
log::trace!(
tracing::trace!(
target: "xcm::fungible_adapter",
"internal_transfer_asset what: {:?}, from: {:?}, to: {:?}",
what, from, to
Expand Down Expand Up @@ -119,7 +119,7 @@ impl<
for FungibleMutateAdapter<Fungible, Matcher, AccountIdConverter, AccountId, CheckingAccount>
{
fn can_check_in(_origin: &Location, what: &Asset, _context: &XcmContext) -> XcmResult {
log::trace!(
tracing::trace!(
target: "xcm::fungible_adapter",
"can_check_in origin: {:?}, what: {:?}",
_origin, what
Expand All @@ -136,7 +136,7 @@ impl<
}

fn check_in(_origin: &Location, what: &Asset, _context: &XcmContext) {
log::trace!(
tracing::trace!(
target: "xcm::fungible_adapter",
"check_in origin: {:?}, what: {:?}",
_origin, what
Expand All @@ -153,7 +153,7 @@ impl<
}

fn can_check_out(_dest: &Location, what: &Asset, _context: &XcmContext) -> XcmResult {
log::trace!(
tracing::trace!(
target: "xcm::fungible_adapter",
"can_check_out dest: {:?}, what: {:?}",
_dest,
Expand All @@ -170,7 +170,7 @@ impl<
}

fn check_out(_dest: &Location, what: &Asset, _context: &XcmContext) {
log::trace!(
tracing::trace!(
target: "xcm::fungible_adapter",
"check_out dest: {:?}, what: {:?}",
_dest,
Expand All @@ -188,7 +188,7 @@ impl<
}

fn deposit_asset(what: &Asset, who: &Location, _context: Option<&XcmContext>) -> XcmResult {
log::trace!(
tracing::trace!(
target: "xcm::fungible_adapter",
"deposit_asset what: {:?}, who: {:?}",
what, who,
Expand All @@ -206,7 +206,7 @@ impl<
who: &Location,
_context: Option<&XcmContext>,
) -> result::Result<AssetsInHolding, XcmError> {
log::trace!(
tracing::trace!(
target: "xcm::fungible_adapter",
"withdraw_asset what: {:?}, who: {:?}",
what, who,
Expand Down
Loading

0 comments on commit 7b32c89

Please sign in to comment.