@@ -54,7 +54,7 @@ and make many small allocations. Put differently, using `encoding/json` and
54
54
Zap takes a different approach. It includes a reflection-free, zero-allocation
55
55
JSON encoder, and the base ` Logger ` strives to avoid serialization overhead
56
56
and allocations wherever possible. By building the high-level ` SugaredLogger `
57
- on that foundation, zap lets users * choose * when they need to count every
57
+ on that foundation, zap lets users _ choose _ when they need to count every
58
58
allocation and when they'd prefer a more familiar, loosely typed API.
59
59
60
60
As measured by its own [ benchmarking suite] [ ] , not only is zap more performant
@@ -64,40 +64,40 @@ id="anchor-versions">[1](#footnote-versions)</sup>
64
64
65
65
Log a message and 10 fields:
66
66
67
- | Package | Time | Time % to zap | Objects Allocated |
68
- | :------ | :--: | :-----------: | :---------------: |
69
- | :zap : zap | 2900 ns/op | +0% | 5 allocs/op
70
- | :zap : zap (sugared) | 3475 ns/op | +20% | 10 allocs/op
71
- | zerolog | 10639 ns/op | +267% | 32 allocs/op
72
- | go-kit | 14434 ns/op | +398% | 59 allocs/op
73
- | logrus | 17104 ns/op | +490% | 81 allocs/op
74
- | apex/log | 32424 ns/op | +1018% | 66 allocs/op
75
- | log15 | 33579 ns/op | +1058% | 76 allocs/op
67
+ | Package | Time | Time % to zap | Objects Allocated |
68
+ | :------------------ | :------- --: | :-----------: | :---------------: |
69
+ | :zap : zap | 2900 ns/op | +0% | 5 allocs/op |
70
+ | :zap : zap (sugared) | 3475 ns/op | +20% | 10 allocs/op |
71
+ | zerolog | 10639 ns/op | +267% | 32 allocs/op |
72
+ | go-kit | 14434 ns/op | +398% | 59 allocs/op |
73
+ | logrus | 17104 ns/op | +490% | 81 allocs/op |
74
+ | apex/log | 32424 ns/op | +1018% | 66 allocs/op |
75
+ | log15 | 33579 ns/op | +1058% | 76 allocs/op |
76
76
77
77
Log a message with a logger that already has 10 fields of context:
78
78
79
- | Package | Time | Time % to zap | Objects Allocated |
80
- | :------ | :--: | :-----------: | :---------------: |
81
- | :zap : zap | 373 ns/op | +0% | 0 allocs/op
82
- | :zap : zap (sugared) | 452 ns/op | +21% | 1 allocs/op
83
- | zerolog | 288 ns/op | -23% | 0 allocs/op
84
- | go-kit | 11785 ns/op | +3060% | 58 allocs/op
85
- | logrus | 19629 ns/op | +5162% | 70 allocs/op
86
- | log15 | 21866 ns/op | +5762% | 72 allocs/op
87
- | apex/log | 30890 ns/op | +8182% | 55 allocs/op
79
+ | Package | Time | Time % to zap | Objects Allocated |
80
+ | :------------------ | :------- --: | :-----------: | :---------------: |
81
+ | :zap : zap | 373 ns/op | +0% | 0 allocs/op |
82
+ | :zap : zap (sugared) | 452 ns/op | +21% | 1 allocs/op |
83
+ | zerolog | 288 ns/op | -23% | 0 allocs/op |
84
+ | go-kit | 11785 ns/op | +3060% | 58 allocs/op |
85
+ | logrus | 19629 ns/op | +5162% | 70 allocs/op |
86
+ | log15 | 21866 ns/op | +5762% | 72 allocs/op |
87
+ | apex/log | 30890 ns/op | +8182% | 55 allocs/op |
88
88
89
89
Log a static string, without any context or ` printf ` -style templating:
90
90
91
- | Package | Time | Time % to zap | Objects Allocated |
92
- | :------ | :--: | :-----------: | :---------------: |
93
- | :zap : zap | 381 ns/op | +0% | 0 allocs/op
94
- | :zap : zap (sugared) | 410 ns/op | +8% | 1 allocs/op
95
- | zerolog | 369 ns/op | -3% | 0 allocs/op
96
- | standard library | 385 ns/op | +1% | 2 allocs/op
97
- | go-kit | 606 ns/op | +59% | 11 allocs/op
98
- | logrus | 1730 ns/op | +354% | 25 allocs/op
99
- | apex/log | 1998 ns/op | +424% | 7 allocs/op
100
- | log15 | 4546 ns/op | +1093% | 22 allocs/op
91
+ | Package | Time | Time % to zap | Objects Allocated |
92
+ | :------------------ | :------ --: | :-----------: | :---------------: |
93
+ | :zap : zap | 381 ns/op | +0% | 0 allocs/op |
94
+ | :zap : zap (sugared) | 410 ns/op | +8% | 1 allocs/op |
95
+ | zerolog | 369 ns/op | -3% | 0 allocs/op |
96
+ | standard library | 385 ns/op | +1% | 2 allocs/op |
97
+ | go-kit | 606 ns/op | +59% | 11 allocs/op |
98
+ | logrus | 1730 ns/op | +354% | 25 allocs/op |
99
+ | apex/log | 1998 ns/op | +424% | 7 allocs/op |
100
+ | log15 | 4546 ns/op | +1093% | 22 allocs/op |
101
101
102
102
## Development Status: Stable
103
103
@@ -131,4 +131,3 @@ pinned in the [benchmarks/go.mod][] file. [↩](#anchor-versions)
131
131
[ cov ] : https://codecov.io/gh/uber-go/zap
132
132
[ benchmarking suite ] : https://github.com/uber-go/zap/tree/master/benchmarks
133
133
[ benchmarks/go.mod ] : https://github.com/uber-go/zap/blob/master/benchmarks/go.mod
134
-
0 commit comments