Skip to content

Commit

Permalink
file output plugin fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrc committed Dec 2, 2016
1 parent 9f6666b commit 504f4e6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugins/outputs/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,13 @@ func (f *File) Write(metrics []telegraf.Metric) error {
}

for _, metric := range metrics {
_, err := f.writer.Write(metric.Serialize())
b, err := f.serializer.Serialize(metric)
if err != nil {
return fmt.Errorf("FAILED to write message: %s, %s", metric.Serialize(), err)
return fmt.Errorf("failed to serialize message: %s", err)
}
_, err = f.writer.Write(b)
if err != nil {
return fmt.Errorf("failed to write message: %s, %s", metric.Serialize(), err)
}
}
return nil
Expand Down

0 comments on commit 504f4e6

Please sign in to comment.