refactor: logparser v5 funcs

This commit is contained in:
Inanc Gumus
2019-08-29 16:08:46 +03:00
parent d28c6d54d2
commit 661e018258
10 changed files with 48 additions and 53 deletions

View File

@ -22,11 +22,13 @@ func NewJSONReport(w io.Writer) *JSONReport {
return &JSONReport{w: w}
}
// Consume generates a JSON report.
// Consume the records and generate a JSON report.
func (t *JSONReport) Consume(records Iterator) error {
enc := json.NewEncoder(t.w)
return records.Each(func(r Record) error {
encode := func(r Record) error {
return enc.Encode(&r)
})
}
return records.Each(encode)
}