Skip to content

Commit

Permalink
Merge pull request #477 from ndegory/fix473
Browse files Browse the repository at this point in the history
Add the Critical(string) function to Logger
  • Loading branch information
luisdavim authored May 23, 2020
2 parents 743a9e8 + 6f9e787 commit 70b6ca0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions internal/app/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ import (

type Logger struct {
*logger.Logger
LoggerInterface
}

type LoggerInterface interface {
Info(string)
Debug(string)
Verbose(string)
Error(string)
Warning(string)
Notice(string)
Critical(string)
Fatal(string)
}

var log *Logger
Expand Down Expand Up @@ -45,6 +57,13 @@ func (l *Logger) Notice(message string) {
baseLogger.Notice(message)
}

func (l *Logger) Critical(message string) {
if _, err := url.ParseRequestURI(settings.SlackWebhook); err == nil {
notifySlack(message, settings.SlackWebhook, true, flags.apply)
}
baseLogger.Critical(message)
}

func (l *Logger) Fatal(message string) {
if _, err := url.ParseRequestURI(settings.SlackWebhook); err == nil {
notifySlack(message, settings.SlackWebhook, true, flags.apply)
Expand Down

0 comments on commit 70b6ca0

Please sign in to comment.