5 // Task is an interface which encapsulates an activity which can be logged.
7 // Updates returns a channel which is written to with the current state
8 // of the Task when an update is present. It is closed when the task is
10 Updates() <-chan *Update
12 // Throttled returns whether or not updates from this task should be
13 // limited when being printed to a sink via *log.Logger.
15 // It is expected to return the same value for a given Task instance.
19 // Update is a single message sent (S) from a Task at a given time (At).
21 // S is the message sent in this update.
23 // At is the time that this update was sent.
26 // Force determines if this update should not be throttled.
30 // Throttled determines whether this update should be throttled, based on the
31 // given earliest time of the next update. The caller should determine how often
32 // updates should be throttled. An Update with Force=true is never throttled.
33 func (u *Update) Throttled(next time.Time) bool {
34 return !(u.Force || u.At.After(next))