@@ -78,12 +78,20 @@ pub const ACTION_TRACE_TARGET: &str = "openmina_core::log::action";
7878#[ macro_export]
7979macro_rules! action_event {
8080 ( $level: expr, $context: expr, $( $tts: tt) * ) => {
81- $crate:: log:: inner:: event!( target: { $crate:: log:: ACTION_TRACE_TARGET } , $level, time = $context. time( ) , node_id = $context. node_id( ) , $( $tts) * )
81+ if $context. log_node_id( ) {
82+ $crate:: log:: inner:: event!( target: { $crate:: log:: ACTION_TRACE_TARGET } , $level, time = $context. time( ) , node_id = $context. node_id( ) , $( $tts) * )
83+ } else {
84+ $crate:: log:: inner:: event!( target: { $crate:: log:: ACTION_TRACE_TARGET } , $level, time = $context. time( ) , $( $tts) * )
85+ }
8286 } ;
8387 ( $level: expr, $context: expr) => {
84- $crate:: log:: inner:: event!( target: { $crate:: log:: ACTION_TRACE_TARGET } , $level, time = $context. time( ) , node_id = $context. node_id( ) )
88+ if $context. log_node_id( ) {
89+ $crate:: log:: inner:: event!( target: { $crate:: log:: ACTION_TRACE_TARGET } , $level, time = $context. time( ) , node_id = $context. node_id( ) )
90+ } else {
91+ $crate:: log:: inner:: event!( target: { $crate:: log:: ACTION_TRACE_TARGET } , $level, time = $context. time( ) )
92+ }
8593 } ;
86- }
94+ }
8795
8896#[ macro_export]
8997macro_rules! action_error {
@@ -139,6 +147,7 @@ pub trait EventContext {
139147 fn timestamp ( & self ) -> redux:: Timestamp ;
140148 fn time ( & self ) -> & ' _ dyn Value ;
141149 fn node_id ( & self ) -> & ' _ dyn Value ;
150+ fn log_node_id ( & self ) -> bool ;
142151}
143152
144153pub trait ActionEvent {
0 commit comments