@@ -282,14 +282,21 @@ func (e *executor) Close() {
282
282
}
283
283
284
284
func (e * executor ) executeEvent (event * history.Event ) error {
285
- e . logger . Debug ( "Executing event" ,
285
+ fields := [] any {
286
286
log .InstanceIDKey , e .workflowState .Instance ().InstanceID ,
287
287
log .EventIDKey , event .ID ,
288
288
log .SeqIDKey , event .SequenceID ,
289
289
log .EventTypeKey , event .Type ,
290
290
log .ScheduleEventIDKey , event .ScheduleEventID ,
291
291
log .IsReplayingKey , e .workflowState .Replaying (),
292
- )
292
+ }
293
+
294
+ attributesFields := getAttributesLoggingFields (event )
295
+ if attributesFields != nil {
296
+ fields = append (fields , attributesFields ... )
297
+ }
298
+
299
+ e .logger .Debug ("Executing event" , fields )
293
300
294
301
var err error
295
302
@@ -676,3 +683,30 @@ func (e *executor) createNewEvent(eventType history.EventType, attributes interf
676
683
opts ... ,
677
684
)
678
685
}
686
+
687
+ func getAttributesLoggingFields (event * history.Event ) []any {
688
+ switch event .Type {
689
+ case history .EventType_WorkflowExecutionStarted :
690
+ attributes := event .Attributes .(* history.ExecutionStartedAttributes )
691
+ return []any {
692
+ log .WorkflowNameKey , attributes .Name ,
693
+ }
694
+ case history .EventType_SubWorkflowScheduled :
695
+ attributes := event .Attributes .(* history.SubWorkflowScheduledAttributes )
696
+ return []any {
697
+ log .WorkflowNameKey , attributes .Name ,
698
+ }
699
+ case history .EventType_SignalReceived :
700
+ attributes := event .Attributes .(* history.SignalReceivedAttributes )
701
+ return []any {
702
+ log .SignalNameKey , attributes .Name ,
703
+ }
704
+ case history .EventType_ActivityScheduled :
705
+ attributes := event .Attributes .(* history.ActivityScheduledAttributes )
706
+ return []any {
707
+ log .ActivityNameKey , attributes .Name ,
708
+ }
709
+ default :
710
+ return nil
711
+ }
712
+ }
0 commit comments