File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,12 @@ type typeNotifier interface {
1010 SendNotification ()
1111}
1212
13+ // Notifier can send log output as notification to admins, with optional batching.
1314type Notifier struct {
1415 types []typeNotifier
1516}
1617
18+ // NewNotifier creates and returns a new Notifier, using global configuration.
1719func NewNotifier (c * cli.Context ) * Notifier {
1820 n := & Notifier {}
1921
@@ -33,12 +35,14 @@ func NewNotifier(c *cli.Context) *Notifier {
3335 return n
3436}
3537
38+ // StartNotification starts a log batch. Notifications will be accumulated after this point and only sent when SendNotification() is called.
3639func (n * Notifier ) StartNotification () {
3740 for _ , t := range n .types {
3841 t .StartNotification ()
3942 }
4043}
4144
45+ // SendNotification sends any notifications accumulated since StartNotification() was called.
4246func (n * Notifier ) SendNotification () {
4347 for _ , t := range n .types {
4448 t .SendNotification ()
You can’t perform that action at this time.
0 commit comments