(b *testing.B)
| 165 | } |
| 166 | |
| 167 | func BenchmarkStringFormatter(b *testing.B) { |
| 168 | fmt := "%{time:2006-01-02T15:04:05} %{level:.1s} %{id:04d} %{module} %{message}" |
| 169 | f := MustStringFormatter(fmt) |
| 170 | |
| 171 | backend := InitForTesting(DEBUG) |
| 172 | buf := &bytes.Buffer{} |
| 173 | log := MustGetLogger("module") |
| 174 | log.Debug("") |
| 175 | record := MemoryRecordN(backend, 0) |
| 176 | |
| 177 | b.ResetTimer() |
| 178 | for i := 0; i < b.N; i++ { |
| 179 | if err := f.Format(1, record, buf); err != nil { |
| 180 | b.Fatal(err) |
| 181 | buf.Truncate(0) |
| 182 | } |
| 183 | } |
| 184 | } |
nothing calls this directly
no test coverage detected