Skip to content

Commit

Permalink
MON-129 use requestLogger instead of log
Browse files Browse the repository at this point in the history
  • Loading branch information
xp-1000 committed Jun 2, 2018
1 parent 7e4fc04 commit a7d1a5e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions zabbix-aws-deregister.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func init() {
}
encryptedPass, ok = os.LookupEnv("ZABBIX_PASS")
if !ok {
log.WithFields(log.Fields{"variable": "ZABBIX_PASS"}).Panic("Environment variable not set")
requestLogger.WithFields(log.Fields{"variable": "ZABBIX_PASS"}).Panic("Environment variable not set")
}

Config.User = decrypt(*requestLogger, encryptedUser, "ZABBIX_USER")
Expand Down Expand Up @@ -144,7 +144,7 @@ func HandleRequest(snsEvents events.SNSEvent) (string, error) {
defer resp.Body.Close()
bodyBytes, _ := ioutil.ReadAll(resp.Body)
bodyString := string(bodyBytes)
log.WithFields(log.Fields{"value": bodyString}).Debug("Retrieving internet IP address")
requestLogger.WithFields(log.Fields{"value": bodyString}).Debug("Retrieving internet IP address")
}

requestLogger = log.WithFields(log.Fields{"stage": "connection"})
Expand Down Expand Up @@ -217,13 +217,13 @@ func HandleRequest(snsEvents events.SNSEvent) (string, error) {
"status": zabbixHostDisable,
})
if err != nil {
log.WithFields(log.Fields{"description": string(descriptionJSON), "cur_name": res[0].Host, "new_name": name, "enabled": false}).WithError(err).Error("Updating zabbix host")
requestLogger.WithFields(log.Fields{"description": string(descriptionJSON), "cur_name": res[0].Host, "new_name": name, "enabled": false}).WithError(err).Error("Updating zabbix host")
return "", err
}

}

log.WithFields(log.Fields{"stage": "success", "instance": autoscalingEvent.InstanceID, "host": res[0].HostId}).Info("Function finished successfully")
requestLogger.WithFields(log.Fields{"stage": "success", "instance": autoscalingEvent.InstanceID, "host": res[0].HostId}).Info("Function finished successfully")
return fmt.Sprintf(autoscalingEvent.InstanceID), nil
}

Expand Down

0 comments on commit a7d1a5e

Please sign in to comment.