file output plugin fixup

This commit is contained in:
Cameron Sparr 2016-12-02 11:36:22 +00:00
parent 9f6666beb3
commit 504f4e69db
1 changed files with 6 additions and 2 deletions

View File

@ -92,9 +92,13 @@ func (f *File) Write(metrics []telegraf.Metric) error {
} }
for _, metric := range metrics { for _, metric := range metrics {
_, err := f.writer.Write(metric.Serialize()) b, err := f.serializer.Serialize(metric)
if err != nil { 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 return nil