8 // ListTask is a Task implementation that logs all updates in a list where each
9 // entry is line-delimited.
15 type ListTask struct {
20 // NewListTask instantiates a new *ListTask instance with the given message.
21 func NewListTask(msg string) *ListTask {
24 ch: make(chan *Update, 1),
28 // Entry logs a line-delimited task entry.
29 func (l *ListTask) Entry(update string) {
31 S: fmt.Sprintf("%s\n", update),
36 func (l *ListTask) Complete() {
38 S: fmt.Sprintf("%s: ...", l.msg),
44 // Throttled implements the Task.Throttled function and ensures that all log
45 // updates are printed to the sink.
46 func (l *ListTask) Throttled() bool { return false }
48 // Updates implements the Task.Updates function and returns a channel of updates
49 // to log to the sink.
50 func (l *ListTask) Updates() <-chan *Update { return l.ch }