[#1619] logger: Update benchmark
All checks were successful
DCO action / DCO (pull_request) Successful in 40s
Vulncheck / Vulncheck (pull_request) Successful in 1m0s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m28s
Build / Build Components (pull_request) Successful in 1m57s
Tests and linters / gopls check (pull_request) Successful in 3m42s
Tests and linters / Run gofumpt (pull_request) Successful in 4m55s
Tests and linters / Staticcheck (pull_request) Successful in 5m53s
Tests and linters / Lint (pull_request) Successful in 6m3s
Tests and linters / Tests (pull_request) Successful in 6m1s
Tests and linters / Tests with -race (pull_request) Successful in 6m46s
All checks were successful
DCO action / DCO (pull_request) Successful in 40s
Vulncheck / Vulncheck (pull_request) Successful in 1m0s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m28s
Build / Build Components (pull_request) Successful in 1m57s
Tests and linters / gopls check (pull_request) Successful in 3m42s
Tests and linters / Run gofumpt (pull_request) Successful in 4m55s
Tests and linters / Staticcheck (pull_request) Successful in 5m53s
Tests and linters / Lint (pull_request) Successful in 6m3s
Tests and linters / Tests (pull_request) Successful in 6m1s
Tests and linters / Tests with -race (pull_request) Successful in 6m46s
Change-Id: I04121a0550b3cdd8b8655fdeb2c5e0d062a96404 Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
b0cf6f51c0
commit
e20df71798
2 changed files with 94 additions and 22 deletions
|
@ -40,3 +40,39 @@ func BenchmarkLoggerError(b *testing.B) {
|
|||
logger.Error(ctx, "test error")
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkLoggerLevelLess(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
prm := Prm{}
|
||||
require.NoError(b, prm.SetLevelString("info"))
|
||||
require.NoError(b, prm.SetTags([][]string{{"main", "debug"}, {"morph", "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")
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkLoggerLevelGreater(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
prm := Prm{}
|
||||
require.NoError(b, prm.SetLevelString("debug"))
|
||||
require.NoError(b, prm.SetTags([][]string{{"main", "error"}, {"morph", "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")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue