Skip to content

Commit

Permalink
Removed zerolog leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
paramite committed Aug 21, 2019
1 parent b31364d commit 1d59491
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func main() {

// spawn entities
metadata := config.GetAgentConfigMetadata()
cfg, err := config.NewConfig(metadata, *log)
cfg, err := config.NewConfig(metadata, log)
if err != nil {
log.Metadata(map[string]interface{}{"error": err})
log.Error("Failed to parse config file.")
Expand All @@ -51,15 +51,15 @@ func main() {
if err != nil {
panic(err.Error())
}
sensuConnector, err := sensu.NewConnector(cfg, *log)
sensuConnector, err := sensu.NewConnector(cfg, log)
if err != nil {
log.Metadata(map[string]interface{}{"error": err})
log.Error("Failed to spawn RabbitMQ connector.")
os.Exit(2)
}
defer sensuConnector.Disconnect()

sensuScheduler, err := sensu.NewScheduler(cfg, *log)
sensuScheduler, err := sensu.NewScheduler(cfg, log)
if err != nil {
log.Metadata(map[string]interface{}{"error": err})
log.Error("Failed to spawn check scheduler.")
Expand Down Expand Up @@ -93,12 +93,20 @@ func main() {
res, err := sensuExecutor.Execute(req)
if err != nil {
reqstr := fmt.Sprintf("Request{name=%s, command=%s, issued=%d}", req.Name, req.Command, req.Issued)
log.Error().Err(err).Str("request", reqstr).Msg("Failed to execute requested command.")
log.Metadata(map[string]interface{}{
"error": err,
"request": reqstr,
})
log.Error("Failed to execute requested command.")
continue
}
results <- res
default:
log.Error().Err(err).Str("request", fmt.Sprintf("%v", req)).Msg("Failed to execute requested command.")
log.Metadata(map[string]interface{}{
"error": err,
"request": req,
})
log.Error("Failed to execute requested command.")
}
}
}()
Expand Down

0 comments on commit 1d59491

Please sign in to comment.