protofsm: reduce log spam during state transitions

In this commit, we reduce log spam a bit during state transitions. We
only log the type of the event when sending the event, as we'll print
the same event when creating the queue "applying", and later when
processing". Next we remove the "applying" log as that first event will
always be logged twice.

The combo of these to changes makes the logs much easier to follow.
This commit is contained in:
Olaoluwa Osuntokun
2025-03-26 16:23:04 -07:00
parent 0053fda6da
commit a307280c40

View File

@@ -237,8 +237,7 @@ func (s *StateMachine[Event, Env]) Stop() {
//
// TODO(roasbeef): bool if processed?
func (s *StateMachine[Event, Env]) SendEvent(ctx context.Context, event Event) {
s.log.DebugS(ctx, "Sending event",
"event", lnutils.SpewLogClosure(event))
s.log.Debugf("Sending event %T", event)
select {
case s.events <- event:
@@ -544,9 +543,6 @@ func (s *StateMachine[Event, Env]) applyEvents(ctx context.Context,
currentState State[Event, Env], newEvent Event) (State[Event, Env],
error) {
s.log.DebugS(ctx, "Applying new event",
"event", lnutils.SpewLogClosure(newEvent))
eventQueue := fn.NewQueue(newEvent)
// Given the next event to handle, we'll process the event, then add