Skip to content

Commit

Permalink
Log error
Browse files Browse the repository at this point in the history
  • Loading branch information
mweagle committed Nov 30, 2019
1 parent a049dfb commit 366e73f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions aws/cloudwatch/structured_metric.go
Expand Up @@ -156,10 +156,14 @@ func (em *EmbeddedMetric) PublishToSink(additionalProperties map[string]interfac
em = em.WithProperty(eachKey, eachValue)
}
rawJSON, rawJSONErr := json.Marshal(em)
var writtenErr error
if rawJSONErr == nil {
io.WriteString(sink, (string)(rawJSON))
_, writtenErr = io.WriteString(sink, (string)(rawJSON))
} else {
io.WriteString(sink, fmt.Sprintf("Error publishing metric: %v", rawJSONErr))
_, writtenErr = io.WriteString(sink, fmt.Sprintf("Error publishing metric: %v", rawJSONErr))
}
if writtenErr != nil {
fmt.Printf("ERROR: %#v", writtenErr)
}
}

Expand Down

0 comments on commit 366e73f

Please sign in to comment.