Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
fix: must be same condition
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkgos committed Apr 16, 2024
1 parent 7cc6165 commit a38c395
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions benchmark_json_test.go
Expand Up @@ -44,11 +44,13 @@ func Benchmark_Json_NativeLogger(b *testing.B) {
zapcore.InfoLevel,
)
logger := zap.New(core)
ctx := context.Background()
b.StartTimer()
for i := 0; i < b.N; i++ {
logger.Info("success",
zap.String("name", "jack"),
zap.Int("age", 18),
dfltCtx(ctx),
)
}
}
Expand Down Expand Up @@ -98,11 +100,13 @@ func Benchmark_Json_NativeSugar(b *testing.B) {
zapcore.InfoLevel,
)
logger := zap.New(core).Sugar()
ctx := context.Background()
b.StartTimer()
for i := 0; i < b.N; i++ {
logger.Infow("success",
"name", "jack",
"age", 18,
dfltCtx(ctx),
)
}
}
Expand Down
4 changes: 4 additions & 0 deletions benchmark_text_test.go
Expand Up @@ -19,11 +19,13 @@ func Benchmark_Text_NativeLogger(b *testing.B) {
zapcore.InfoLevel,
)
logger := zap.New(core)
ctx := context.Background()
b.StartTimer()
for i := 0; i < b.N; i++ {
logger.Info("success",
zap.String("name", "jack"),
zap.Int("age", 18),
dfltCtx(ctx),
)
}
}
Expand Down Expand Up @@ -73,11 +75,13 @@ func Benchmark_Text_NativeSugar(b *testing.B) {
zapcore.InfoLevel,
)
logger := zap.New(core).Sugar()
ctx := context.Background()
b.StartTimer()
for i := 0; i < b.N; i++ {
logger.Infow("success",
"name", "jack",
"age", 18,
dfltCtx(ctx),
)
}
}
Expand Down

0 comments on commit a38c395

Please sign in to comment.