Home

Handler phsym/zeroslog

Handlers
Bench Tests
Verify Tests
Summary Links

phsym/zeroslog is a wrapper around the pre-existing rs/zerolog logging library. The phsym/zerolog handler, like the underlying rs/zerolog logging library, is in the fastest ranks of slog.Handler implementations tested.

phsym/zeroslog
rs/zerolog

Benchmark Data

Score: 98.76
Benchmark Runs Ns/Op Allocs/Op Bytes/Op MB/Sec Score
Attributes 1,225,458 983.30 2 272 402.73 99.48
Big Group 70,723 16,829.00 1 49 656.80 99.19
Disabled 322,001,266 3.73 0 0 0.00 96.86
Key Values 1,000,000 1,021.00 2 272 387.74 99.47
Logging 67,497 17,931.00 0 0 473.82 99.80
Simple 5,719,732 209.50 0 0 367.61 99.71
Simple Source 2,413,593 498.70 4 312 302.80 94.33
With Attrs Attributes 1,217,311 994.70 2 272 751.01 99.65
With Attrs Key Values 1,000,000 1,066.00 2 272 701.03 99.62
With Attrs Simple 5,544,789 224.70 0 0 1,905.13 99.92
With Group Attributes 1,035,679 1,108.00 3 560 370.19 98.53
With Group Key Values 1,000,000 1,151.00 3 560 356.25 98.59

Benchmark Charts

phsym/zeroslog Ns/Op phsym/zeroslog Allocs/Op
phsym/zeroslog Bytes/Op phsym/zeroslog GB/Sec

Warnings

Score: 47.69
Required
EmptyAttributes Empty attribute(s) logged ("":null)
Verify: Attribute With Empty

Verify: Attributes Empty

Verify: Attributes With Empty

GroupEmpty Empty (sub)group(s) logged
Verify: Group With Multi Sub Empty

found 'subGroup' group

GroupInline Group with empty key does not inline subfields
Verify: Group Inline

SlogTest Failure of embedded slog/slogtest
Verify: Slog Test

missing key "msg"
this test expects slog.TimeKey, slog.LevelKey and slog.MessageKey

unexpected key ""
a Handler should ignore an empty Attr

unexpected key "time"
a Handler should ignore a zero Record.Time

missing key "c"
a Handler should inline the Attrs of a group with an empty key

missing key "msg"
a Handler should handle the WithGroup method

missing key "msg"
a Handler should handle multiple WithGroup and WithAttr calls

missing key "msg"
a Handler should not output groups if there are no attributes

unexpected key "H"
a Handler should not output groups if there are no attributes

WithGroupEmpty Empty WithGroup() logged
Verify: With Group Empty

too many fields, found field 'group1', value is group, length: 1

ZeroTime Zero time is logged
Verify: Zero Time

0001-01-01T00:00:00Z

Implied
MessageKey Wrong message key (should be 'msg')
Verify: Canceled Context

`message`

Verify: Canceled Context

`message`

Verify: Canceled Context

`message`

Verify: Keys

`message`

Verify: Source Key

`message`

Verify: Zero PC

`message`

Verify: Zero Time

`message`

NoReplAttr HandlerOptions.ReplaceAttr not available
Verify: Replace Attr

too many attributes: 6, alpha == beta, change still exists, remove still exists

Verify: Replace Attr Basic

too many attributes: 4

time field still exists

message field still exists

source ==

Verify: Replace Attr Fn Change Key

too few attributes: 3

no message key

message not string

Verify: Replace Attr Fn Level Case

level value not null

Verify: Replace Attr Fn Multi

Verify: Replace Attr Fn Remove Empty Key

Verify: Replace Attr Fn Remove Time

time value not empty string

SourceCaller Source data logged as 'caller' instead of 'source'
Bench: Simple Source

/home/runner/work/go-slog/go-slog/bench/tests/benchmarks.go:96

Verify: Source Key

/opt/hostedtoolcache/go/1.22.2/x64/src/reflect/value.go:596

Suggested
Duplicates Duplicate field(s) found
Verify: Attribute Duplicate

map[alpha:2 charlie:3]

Verify: Attribute With Duplicate

map[alpha:2 charlie:3]

DurationMillis slog.Duration() logs milliseconds instead of nanoseconds
Verify: Log Attributes

LevelCase Log level in lowercase
Verify: Canceled Context

'info'

Verify: Canceled Context

'info'

Verify: Canceled Context

'info'

Verify: Key Case

'error'

Verify: Key Case

'debug'

Verify: Key Case

'info'

Verify: Key Case

'warn'

Verify: Keys

'info'

Verify: Source Key

'info'

Verify: Zero PC

'info'

Verify: Zero Time

'info'

TimeMillis slog.Time() logs milliseconds instead of nanoseconds
Verify: Log Attributes

2024-05-07T23:50:49Z