| 317 | } |
| 318 | |
| 319 | func (s *Stats) createStatsCSV() error { |
| 320 | buf := &bytes.Buffer{} |
| 321 | fmt.Fprintln(buf, "section,log line sizes,distribution of log lines sizes") |
| 322 | (&s.sizes).print(buf) |
| 323 | if s.times.fieldIdx != -1 { |
| 324 | fmt.Fprintln(buf, "section,timestamps,distribution of timestamps") |
| 325 | (&s.times).print(buf) |
| 326 | } |
| 327 | for i := range s.fields { |
| 328 | fname := s.cfg.FieldNames[s.fields[i].field] |
| 329 | fmt.Fprintf(buf, "section,%s,distribution of number of log lines per distinct %s value\n", fname, fname) |
| 330 | s.fields[i].print(buf, s.cfg.FieldNames) |
| 331 | } |
| 332 | return os.WriteFile(s.csvPath, buf.Bytes(), os.ModePerm) |
| 333 | |
| 334 | } |
| 335 | |
| 336 | // Stats implements baker.Output |
| 337 | func (s *Stats) Stats() baker.OutputStats { |