Closed weedge closed 1 year ago
need to sign cla it's ok , signed the CLA
Please fix the problem with code formatting
Please fix the problem with code formatting
golangci-lint run --out-format=github-actions --path-prefix=./logging/zap -E gofumpt, it's ok
Seems not necessary to introduce logger, zap.Any is even slower than sugar.
Seems not necessary to introduce logger, zap.Any is even slower than sugar.
I see https://github.com/uber-go/zap#performance performance is good to me; Please show some benchmark ? i see zap.Any code switch case , if defined type , no reflection, like %v or %+v;
Seems not necessary to introduce logger, zap.Any is even slower than sugar.
I see https://github.com/uber-go/zap#performance performance is good to me; Please show some benchmark ? i see zap.Any code switch case , if defined type , no reflection, like %v or %+v;
func BenchmarkZapAny(b *testing.B) {
l, _ := zap.NewProduction()
for i := 0; i < b.N; i++ {
l.Info("bench", zap.String("key", "value"), zap.Any("key1", "value1"))
}
}
func BenchmarkZapSugar(b *testing.B) {
l, _ := zap.NewProduction()
s := l.Sugar()
for i := 0; i < b.N; i++ {
s.Infow("bench", "key", "value", zap.Any("key1", "value1"))
}
}
https://pkg.go.dev/go.uber.org/zap#hdr-Choosing_a_Logger
sugar has similar methods.
Seems not necessary to introduce logger, zap.Any is even slower than sugar.
I see https://github.com/uber-go/zap#performance performance is good to me; Please show some benchmark ? i see zap.Any code switch case , if defined type , no reflection, like %v or %+v;
func BenchmarkZapAny(b *testing.B) { l, _ := zap.NewProduction() for i := 0; i < b.N; i++ { l.Info("bench", zap.String("key", "value"), zap.Any("key1", "value1")) } } func BenchmarkZapSugar(b *testing.B) { l, _ := zap.NewProduction() s := l.Sugar() for i := 0; i < b.N; i++ { s.Infow("bench", "key", "value", zap.Any("key1", "value1")) } }
https://pkg.go.dev/go.uber.org/zap#hdr-Choosing_a_Logger
sugar has similar methods.
3q~, sugar **w method print kv log is ok~
@CoderPoet Seems that all issues are fixed. Please help to take a look at this pr, thanks!
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: CoderPoet, weedge
The full list of commands accepted by this bot can be found here.
The pull request process is described here
go get go.opentelemetry.io/otel@v1.11.1
CHANGE:
add zap logger for zap fields, log kv pairs
fix: print span info with ctx