madkins/sloggy is a new slog.Handler built from the ground up to generate JSON log records.
While the performance isn't top-tier, this handler adheres faithfully to documented slog.Handler
and observed slog.JSONHandler behavior.
The madkins/flash handler, derived from this one, has better performance.
|
madkins/flash
madkins/sloggy
|
Benchmark |
Runs |
Ns/Op |
Allocs/Op |
Bytes/Op |
MB/Sec |
Attributes |
427,345 |
2,826.00 |
64 |
1,384 |
158.55 |
Big Group |
17,518 |
68,957.00 |
2,358 |
25,120 |
174.48 |
Disabled |
320,593,141 |
3.75 |
0 |
0 |
0.00 |
Key Values |
416,635 |
2,863.00 |
64 |
1,384 |
156.14 |
Logging |
17,457 |
68,537.00 |
1,865 |
26,992 |
140.25 |
Simple |
1,759,131 |
692.10 |
14 |
240 |
128.60 |
Simple Source |
646,135 |
1,756.00 |
30 |
1,280 |
162.31 |
With Attrs Attributes |
397,540 |
2,933.00 |
64 |
1,384 |
286.06 |
With Attrs Key Values |
411,616 |
2,891.00 |
64 |
1,384 |
289.85 |
With Attrs Simple |
1,716,230 |
692.30 |
14 |
240 |
693.31 |
With Group Attributes |
379,204 |
2,839.00 |
64 |
1,384 |
163.06 |
With Group Key Values |
399,204 |
2,983.00 |
64 |
1,384 |
155.21 |
|