@@ -208,9 +208,12 @@ impl<Config: config::Config> ExecuteXcm<Config::RuntimeCall> for XcmExecutor<Con
208208 weight_credit : Weight ,
209209 ) -> Outcome {
210210 let origin = origin. into ( ) ;
211- log :: trace!(
211+ tracing :: trace!(
212212 target: "xcm::execute" ,
213- "origin: {origin:?}, message: {message:?}, weight_credit: {weight_credit:?}" ,
213+ ?origin,
214+ ?message,
215+ ?weight_credit,
216+ "Executing message" ,
214217 ) ;
215218 let mut properties = Properties { weight_credit, message_id : None } ;
216219
@@ -226,10 +229,13 @@ impl<Config: config::Config> ExecuteXcm<Config::RuntimeCall> for XcmExecutor<Con
226229 xcm_weight,
227230 & mut properties,
228231 ) {
229- log :: trace!(
232+ tracing :: trace!(
230233 target: "xcm::execute" ,
231- "Barrier blocked execution! Error: {e:?}. \
232- (origin: {origin:?}, message: {message:?}, properties: {properties:?})",
234+ ?origin,
235+ ?message,
236+ ?properties,
237+ error = ?e,
238+ "Barrier blocked execution" ,
233239 ) ;
234240 return Outcome :: Error { error : XcmError :: Barrier }
235241 }
@@ -240,7 +246,7 @@ impl<Config: config::Config> ExecuteXcm<Config::RuntimeCall> for XcmExecutor<Con
240246
241247 while !message. 0 . is_empty ( ) {
242248 let result = vm. process ( message) ;
243- log :: trace!( target: "xcm::execute" , " result: {result:?} ") ;
249+ tracing :: trace!( target: "xcm::execute" , ? result, "Message executed ") ;
244250 message = if let Err ( error) = result {
245251 vm. total_surplus . saturating_accrue ( error. weight ) ;
246252 vm. error = Some ( ( error. index , error. xcm_error ) ) ;
@@ -282,11 +288,11 @@ pub struct ExecutorError {
282288#[ cfg( feature = "runtime-benchmarks" ) ]
283289impl From < ExecutorError > for frame_benchmarking:: BenchmarkError {
284290 fn from ( error : ExecutorError ) -> Self {
285- log :: error!(
286- "XCM ERROR >> Index: {:?}, Error: {:?}, Weight: {:?}" ,
287- error. index ,
288- error. xcm_error ,
289- error . weight
291+ tracing :: error!(
292+ index = ?error . index ,
293+ xcm_error = ? error. xcm_error ,
294+ weight = ? error. weight ,
295+ "XCM ERROR" ,
290296 ) ;
291297 Self :: Stop ( "xcm executor error: see error logs" )
292298 }
@@ -326,10 +332,12 @@ impl<Config: config::Config> XcmExecutor<Config> {
326332 let mut weight_used = xcm_weight. saturating_sub ( self . total_surplus ) ;
327333
328334 if !self . holding . is_empty ( ) {
329- log :: trace!(
335+ tracing :: trace!(
330336 target: "xcm::post_process" ,
331- "Trapping assets in holding register: {:?}, context: {:?} (original_origin: {:?})" ,
332- self . holding, self . context, self . original_origin,
337+ holding_register = ?self . holding,
338+ context = ?self . context,
339+ original_origin = ?self . original_origin,
340+ "Trapping assets in holding register" ,
333341 ) ;
334342 let effective_origin = self . context . origin . as_ref ( ) . unwrap_or ( & self . original_origin ) ;
335343 let trap_weight =
@@ -342,7 +350,13 @@ impl<Config: config::Config> XcmExecutor<Config> {
342350 // TODO: #2841 #REALWEIGHT We should deduct the cost of any instructions following
343351 // the error which didn't end up being executed.
344352 Some ( ( _i, e) ) => {
345- log:: trace!( target: "xcm::post_process" , "Execution errored at {:?}: {:?} (original_origin: {:?})" , _i, e, self . original_origin) ;
353+ tracing:: trace!(
354+ target: "xcm::post_process" ,
355+ instruction = ?_i,
356+ error = ?e,
357+ original_origin = ?self . original_origin,
358+ "Execution failed" ,
359+ ) ;
346360 Outcome :: Incomplete { used : weight_used, error : e }
347361 } ,
348362 }
@@ -363,8 +377,12 @@ impl<Config: config::Config> XcmExecutor<Config> {
363377 msg : Xcm < ( ) > ,
364378 reason : FeeReason ,
365379 ) -> Result < XcmHash , XcmError > {
366- log:: trace!(
367- target: "xcm::send" , "Sending msg: {msg:?}, to destination: {dest:?}, (reason: {reason:?})"
380+ tracing:: trace!(
381+ target: "xcm::send" ,
382+ ?msg,
383+ destination = ?dest,
384+ reason = ?reason,
385+ "Sending msg" ,
368386 ) ;
369387 let ( ticket, fee) = validate_send :: < Config :: XcmSender > ( dest, msg) ?;
370388 self . take_fee ( fee, reason) ?;
@@ -400,20 +418,25 @@ impl<Config: config::Config> XcmExecutor<Config> {
400418 // `holding_limit` items (which has a best case outcome of holding.len() == holding_limit),
401419 // then the operation is guaranteed to succeed.
402420 let worst_case_holding_len = self . holding . len ( ) + assets_length;
403- log:: trace!( target: "xcm::ensure_can_subsume_assets" , "worst_case_holding_len: {:?}, holding_limit: {:?}" , worst_case_holding_len, self . holding_limit) ;
421+ tracing:: trace!(
422+ target: "xcm::ensure_can_subsume_assets" ,
423+ ?worst_case_holding_len,
424+ holding_limit = ?self . holding_limit,
425+ "Ensuring subsume assets work" ,
426+ ) ;
404427 ensure ! ( worst_case_holding_len <= self . holding_limit * 2 , XcmError :: HoldingWouldOverflow ) ;
405428 Ok ( ( ) )
406429 }
407430
408431 /// Refund any unused weight.
409432 fn refund_surplus ( & mut self ) -> Result < ( ) , XcmError > {
410433 let current_surplus = self . total_surplus . saturating_sub ( self . total_refunded ) ;
411- log :: trace!(
434+ tracing :: trace!(
412435 target: "xcm::refund_surplus" ,
413- " total_surplus: {:?}, total_refunded: {:?}, current_surplus: {:?}" ,
414- self . total_surplus ,
415- self . total_refunded ,
416- current_surplus ,
436+ total_surplus = ? self . total_surplus ,
437+ total_refunded = ? self . total_refunded ,
438+ ?current_surplus ,
439+ "Refunding surplus" ,
417440 ) ;
418441 if current_surplus. any_gt ( Weight :: zero ( ) ) {
419442 if let Some ( w) = self . trader . refund_weight ( current_surplus, & self . context ) {
@@ -426,7 +449,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
426449 . defensive_proof (
427450 "refund_weight returned an asset capable of buying weight; qed" ,
428451 ) ;
429- log :: error!(
452+ tracing :: error!(
430453 target: "xcm::refund_surplus" ,
431454 "error: HoldingWouldOverflow" ,
432455 ) ;
@@ -436,10 +459,9 @@ impl<Config: config::Config> XcmExecutor<Config> {
436459 self . holding . subsume_assets ( w. into ( ) ) ;
437460 }
438461 }
439- log :: trace!(
462+ tracing :: trace!(
440463 target: "xcm::refund_surplus" ,
441- "total_refunded: {:?}" ,
442- self . total_refunded,
464+ total_refunded = ?self . total_refunded,
443465 ) ;
444466 Ok ( ( ) )
445467 }
@@ -448,13 +470,13 @@ impl<Config: config::Config> XcmExecutor<Config> {
448470 if Config :: FeeManager :: is_waived ( self . origin_ref ( ) , reason. clone ( ) ) {
449471 return Ok ( ( ) )
450472 }
451- log :: trace!(
473+ tracing :: trace!(
452474 target: "xcm::fees" ,
453- "taking fee: {:?} from origin_ref: {:?} in fees_mode: {:?} for a reason: {:?}" ,
454- fee ,
455- self . origin_ref ( ) ,
456- self . fees_mode ,
457- reason ,
475+ ?fee ,
476+ origin_ref = ? self . origin_ref ( ) ,
477+ fees_mode = ? self . fees_mode ,
478+ ?reason ,
479+ "Taking fees" ,
458480 ) ;
459481 let paid = if self . fees_mode . jit_withdraw {
460482 let origin = self . origin_ref ( ) . ok_or ( XcmError :: BadOrigin ) ?;
@@ -507,7 +529,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
507529 let reanchor_context = Config :: UniversalLocation :: get ( ) ;
508530 let reanchored =
509531 reanchorable. reanchored ( & destination, & reanchor_context) . map_err ( |error| {
510- log :: error!( target: "xcm::reanchor" , "Failed reanchoring with error {error:?} " ) ;
532+ tracing :: error!( target: "xcm::reanchor" , ?error , "Failed reanchoring with error" ) ;
511533 XcmError :: ReanchorFailed
512534 } ) ?;
513535 Ok ( ( reanchored, reanchor_context) )
@@ -530,13 +552,12 @@ impl<Config: config::Config> XcmExecutor<Config> {
530552 }
531553
532554 fn process ( & mut self , xcm : Xcm < Config :: RuntimeCall > ) -> Result < ( ) , ExecutorError > {
533- log :: trace!(
555+ tracing :: trace!(
534556 target: "xcm::process" ,
535- "origin: {:?}, total_surplus/refunded: {:?}/{:?}, error_handler_weight: {:?}" ,
536- self . origin_ref( ) ,
537- self . total_surplus,
538- self . total_refunded,
539- self . error_handler_weight,
557+ origin = ?self . origin_ref( ) ,
558+ total_surplus = ?self . total_surplus,
559+ total_refunded = ?self . total_refunded,
560+ error_handler_weight = ?self . error_handler_weight,
540561 ) ;
541562 let mut result = Ok ( ( ) ) ;
542563 for ( i, instr) in xcm. 0 . into_iter ( ) . enumerate ( ) {
@@ -566,7 +587,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
566587 self . process_instruction ( instr)
567588 } ) ;
568589 if let Err ( e) = inst_res {
569- log :: trace!( target: "xcm::execute" , "!!! ERROR: {:?}" , e) ;
590+ tracing :: trace!( target: "xcm::execute" , "!!! ERROR: {:?}" , e) ;
570591 * r = Err ( ExecutorError {
571592 index : i as u32 ,
572593 xcm_error : e,
@@ -588,11 +609,12 @@ impl<Config: config::Config> XcmExecutor<Config> {
588609 & mut self ,
589610 instr : Instruction < Config :: RuntimeCall > ,
590611 ) -> Result < ( ) , XcmError > {
591- log :: trace!(
612+ tracing :: trace!(
592613 target: "xcm::process_instruction" ,
593- "=== {:?}" ,
594- instr
614+ instruction = ?instr ,
615+ "Processing instruction" ,
595616 ) ;
617+
596618 match instr {
597619 WithdrawAsset ( assets) => {
598620 let origin = self . origin_ref ( ) . ok_or ( XcmError :: BadOrigin ) ?;
@@ -694,7 +716,7 @@ impl<Config: config::Config> XcmExecutor<Config> {
694716 Transact { origin_kind, require_weight_at_most, mut call } => {
695717 // We assume that the Relay-chain is allowed to use transact on this parachain.
696718 let origin = self . cloned_origin ( ) . ok_or_else ( || {
697- log :: trace!(
719+ tracing :: trace!(
698720 target: "xcm::process_instruction::transact" ,
699721 "No origin provided" ,
700722 ) ;
@@ -704,21 +726,22 @@ impl<Config: config::Config> XcmExecutor<Config> {
704726
705727 // TODO: #2841 #TRANSACTFILTER allow the trait to issue filters for the relay-chain
706728 let message_call = call. take_decoded ( ) . map_err ( |_| {
707- log :: trace!(
729+ tracing :: trace!(
708730 target: "xcm::process_instruction::transact" ,
709731 "Failed to decode call" ,
710732 ) ;
711733
712734 XcmError :: FailedToDecode
713735 } ) ?;
714736
715- log :: trace!(
737+ tracing :: trace!(
716738 target: "xcm::process_instruction::transact" ,
717- "Processing call: {message_call:?}" ,
739+ ?call,
740+ "Processing call" ,
718741 ) ;
719742
720743 if !Config :: SafeCallFilter :: contains ( & message_call) {
721- log :: trace!(
744+ tracing :: trace!(
722745 target: "xcm::process_instruction::transact" ,
723746 "Call filtered by `SafeCallFilter`" ,
724747 ) ;
@@ -729,26 +752,31 @@ impl<Config: config::Config> XcmExecutor<Config> {
729752 let dispatch_origin =
730753 Config :: OriginConverter :: convert_origin ( origin. clone ( ) , origin_kind) . map_err (
731754 |_| {
732- log :: trace!(
755+ tracing :: trace!(
733756 target: "xcm::process_instruction::transact" ,
734- "Failed to convert origin {origin:?} and origin kind {origin_kind:?} to a local origin."
757+ ?origin,
758+ ?origin_kind,
759+ "Failed to convert origin to a local origin."
735760 ) ;
736761
737762 XcmError :: BadOrigin
738763 } ,
739764 ) ?;
740765
741- log :: trace!(
766+ tracing :: trace!(
742767 target: "xcm::process_instruction::transact" ,
743- "Dispatching with origin: {dispatch_origin:?}" ,
768+ origin = ?dispatch_origin,
769+ "Dispatching with origin" ,
744770 ) ;
745771
746772 let weight = message_call. get_dispatch_info ( ) . weight ;
747773
748774 if !weight. all_lte ( require_weight_at_most) {
749- log :: trace!(
775+ tracing :: trace!(
750776 target: "xcm::process_instruction::transact" ,
751- "Max {weight} bigger than require at most {require_weight_at_most}" ,
777+ %weight,
778+ %require_weight_at_most,
779+ "Max weight bigger than require at most" ,
752780 ) ;
753781
754782 return Err ( XcmError :: MaxWeightInvalid )
@@ -757,17 +785,19 @@ impl<Config: config::Config> XcmExecutor<Config> {
757785 let maybe_actual_weight =
758786 match Config :: CallDispatcher :: dispatch ( message_call, dispatch_origin) {
759787 Ok ( post_info) => {
760- log :: trace!(
788+ tracing :: trace!(
761789 target: "xcm::process_instruction::transact" ,
762- "Dispatch successful: {post_info:?}"
790+ ?post_info,
791+ "Dispatch successful"
763792 ) ;
764793 self . transact_status = MaybeErrorCode :: Success ;
765794 post_info. actual_weight
766795 } ,
767796 Err ( error_and_info) => {
768- log :: trace!(
797+ tracing :: trace!(
769798 target: "xcm::process_instruction::transact" ,
770- "Dispatch failed {error_and_info:?}"
799+ ?error_and_info,
800+ "Dispatch failed"
771801 ) ;
772802
773803 self . transact_status = error_and_info. error . encode ( ) . into ( ) ;
0 commit comments