[#1619] logger: Add benchmark

```
goos: linux
goarch: amd64
pkg: git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
   10000	       520.1 ns/op	      22 B/op	       0 allocs/op
   10000	       565.8 ns/op	      23 B/op	       0 allocs/op
   10000	       522.7 ns/op	      22 B/op	       0 allocs/op
   10000	       530.1 ns/op	      23 B/op	       0 allocs/op
   10000	       658.2 ns/op	      23 B/op	       0 allocs/op
   10000	       523.1 ns/op	      23 B/op	       0 allocs/op
   10000	       577.9 ns/op	      22 B/op	       0 allocs/op
   10000	       530.1 ns/op	      22 B/op	       0 allocs/op
   10000	       521.0 ns/op	      23 B/op	       0 allocs/op
   10000	       544.0 ns/op	      22 B/op	       0 allocs/op
PASS
ok  	git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger	0.065s
```

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2025-02-04 09:11:36 +03:00
parent 7398ffd1c4
commit c692fc9071

View file

@ -0,0 +1,28 @@
package logger
import (
"context"
"testing"
"github.com/stretchr/testify/require"
)
func Benchmark_loggerLog(b *testing.B) {
ctx := context.Background()
prm := Prm{}
require.NoError(b, prm.SetLevelString("debug"))
logger, err := NewLogger(prm)
require.NoError(b, err)
b.ResetTimer()
b.ReportAllocs()
for range b.N {
logger.Debug(ctx, "test debug")
logger.Info(ctx, "test info")
logger.Warn(ctx, "test warn")
logger.Error(ctx, "test error")
}
}