Skip to content

Commit 8e7f220

Browse files
author
Justin Reagor
committed
Add optional debug logging of timer/timeout events
1 parent 5c57832 commit 8e7f220

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

events/timer.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package events
33
import (
44
"context"
55
"time"
6+
7+
log "github.com/sirupsen/logrus"
68
)
79

810
// NewEventTimeout starts a goroutine on a timer that will send a
@@ -26,7 +28,9 @@ func NewEventTimeout(
2628
return
2729
}
2830
}()
29-
rx <- Event{Code: TimerExpired, Source: name}
31+
event := Event{Code: TimerExpired, Source: name}
32+
log.Debugf("timeout: %v", event)
33+
rx <- event
3034
}
3135
}()
3236
}
@@ -53,7 +57,9 @@ func NewEventTimer(
5357
case <-ctx.Done():
5458
return
5559
case <-ticker.C:
56-
rx <- Event{Code: TimerExpired, Source: name}
60+
event := Event{Code: TimerExpired, Source: name}
61+
log.Debugf("timer: %v", event)
62+
rx <- event
5763
}
5864
}
5965
}()

0 commit comments

Comments
 (0)