Commit 35766091 authored by Nogweii's avatar Nogweii
Browse files

actually use WithError, change some severity

some fatal logs weren't actually fatal, so drop them down to just error
instead.
parent f9b8fd0f
......@@ -27,7 +27,8 @@ func main() {
case jsonMessage := <-stream:
allDomains, err := jsonMessage.ArrayOfStrings("data", "leaf_cert", "all_domains")
if err != nil {
log.WithFields(log.Fields{"error": err}).Fatal("Error decoding json string to find all domains")
log.WithError(err).Error("Error decoding json string to find all domains")
continue
}
anyGlobMatch := false
......@@ -62,7 +63,7 @@ func matchesDomains(domainName string) bool {
func readDomainsFromFile(filepath string) []glob.Glob {
file, err := os.Open(filepath)
if err != nil {
log.WithFields(log.Fields{"error": err}).Fatal("Failed to open file ", filepath)
log.WithError(err).Fatal("Failed to open file ", filepath)
}
defer file.Close()
......@@ -72,13 +73,13 @@ func readDomainsFromFile(filepath string) []glob.Glob {
// TODO: skip blank and commented lines
myGlob, err := glob.Compile(text)
if err != nil {
log.WithFields(log.Fields{"error": err}).Fatal("Invalid glob ", text)
log.WithError(err).Error("Invalid glob ", text)
}
globs = append(globs, myGlob)
}
if err := scanner.Err(); err != nil {
log.WithFields(log.Fields{"error": err}).Fatal("Could not scan through file")
log.WithError(err).Fatal("Could not scan through file")
}
return globs
......
......@@ -23,6 +23,6 @@ func notify(allDomains []string) {
// Send the message to the recipient
_, err := app.SendMessage(message, recipient)
if err != nil {
log.WithFields(log.Fields{"error": err}).Fatal("Could not send pushover message")
log.WithError(err).Error("Could not send pushover message")
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment