// WriteTo pretty-prints the metrics and writes the result to a MetricsWriter.
WriteTo pretty-prints the metrics and writes the result to a MetricsWriter.
// WriteTo pretty - prints the metrics and writes the result to a MetricsWriter .
func (m NamedMetrics) WriteTo(table MetricsWriter) {
	table.SetHeader([]string{"Event", fmt.Sprintf("Count (%s)", m.Name)})
	for _, r := range m.Results {
		table.Append([]string{
			r.Label,
			fmt.Sprintf("%d", r.Value),
		})
	}
	table.Append([]string{
		"time-elapsed",
		fmt.Sprintf("%s", m.Elapsed),
	})
	table.Render()
}
func ( m NamedMetrics ) WriteTo ( table MetricsWriter ) { table . SetHeader ( [ ] string { " " , fmt . Sprintf ( " " , m . Name ) } ) for _ , r := range m . Results { table . Append ( [ ] string { r . Label , fmt . Sprintf ( " " , r . Value ) , } ) } table . Append ( [ ] string { " " , fmt . Sprintf ( " " , m . Elapsed ) , } ) table . Render ( ) }
WriteTo pretty-prints the metrics and writes the result to a MetricsWriter.
WriteTo pretty - prints the metrics and writes the result to a MetricsWriter .