Skip to content
Permalink
Browse files

Log error

  • Loading branch information
mweagle committed Nov 30, 2019
1 parent a049dfb commit 366e73fb7b440f0eac25d76f5f5279106984a14d
Showing with 6 additions and 2 deletions.
  1. +6 −2 aws/cloudwatch/structured_metric.go
@@ -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)
}
}

0 comments on commit 366e73f

Please sign in to comment.
You can’t perform that action at this time.