Skip to content

Commit

Permalink
Overall += Add{OK,Warning,Critical,Unknown}
Browse files Browse the repository at this point in the history
The current Add() requires the user to manually access the defined
constants for OK, Warning, Critical, and Unknown.

The four new methods to not require the use to manually specify them.
  • Loading branch information
MEschenbacher committed Nov 30, 2020
1 parent a325f72 commit 353b274
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions result/overall.go
Expand Up @@ -16,6 +16,22 @@ type Overall struct {
Outputs []string
}

func (o *Overall) AddOK(output string) {
o.Add(check.OK, output)
}

func (o *Overall) AddWarning(output string) {
o.Add(check.Warning, output)
}

func (o *Overall) AddCritical(output string) {
o.Add(check.Critical, output)
}

func (o *Overall) AddUnknown(output string) {
o.Add(check.Unknown, output)
}

func (o *Overall) Add(state int, output string) {
switch state {
case check.OK:
Expand Down

0 comments on commit 353b274

Please sign in to comment.