Home

Handler chanchal/zaphandler

Handlers
Bench Tests
Verify Tests
Summary Links

chanchal/zaphandler is a wrapper around the pre-existing uber-go/zap logging library.

chanchal/zaphandler
uber-go/zap

Benchmark Data

Benchmark Runs Ns/Op Allocs/Op Bytes/Op MB/Sec
Attributes 792,762 1,440.00 5 416 270.19
Big Group 51,025 23,697.00 215 5,214 444.16
Disabled 41,174,551 29.07 0 0 0.00
Key Values 756,090 1,507.00 5 417 258.15
Logging 39,780 33,850.00 51 1,635 244.96
Simple 3,169,288 373.40 1 32 195.52
Simple Source 1,968,339 610.80 3 280 175.19
With Attrs Attributes 765,348 1,532.00 5 416 481.21
With Attrs Key Values 789,968 1,529.00 5 416 482.14
With Attrs Simple 3,114,000 384.10 1 32 1,096.03
With Group Attributes 781,776 1,535.00 7 505 262.48
With Group Key Values 703,856 1,584.00 7 505 254.34

Check box to see charts

Warnings

Required
SlogTest Failure of embedded slog/slogtest
Verify: Slog Test

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

missing key "c"
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: 0

Implied
CanceledContext Canceled context blocks logging
Verify: Canceled Context

LevelMath Log levels are not properly treated as integers
Verify: Default Level

INFO+1 is not enabled when WARN is set

Verify: Default Level

INFO+1 is not enabled when WARN is set

Verify: Level Configured

1 is not enabled when INFO is set

Verify: Level Configured

1 is not enabled when INFO is set

Verify: Level Different

5 is not enabled when WARN is set

Verify: Level Different

5 is not enabled when WARN is set

Verify: Level Var

INFO+1 is not enabled when INFO is set

Verify: Level Var

5 is not enabled when WARN is enabled

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

msg field still exists

source ==

Verify: Replace Attr Fn Remove Empty Key

NoReplAttrBasic HandlerOptions.ReplaceAttr not available for basic fields
Verify: Replace Attr Fn Level Case

level value not null

Verify: Replace Attr Fn Multi

Verify: Replace Attr Fn Remove Time

time value not empty string

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

tests/benchmarks.go:96

Verify: Source Key

reflect/value.go:596

WithGroup WithGroup doesn't embed following attributes into group
Verify: Group With Multi

Verify: Group With Multi Sub Empty

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

map[alpha:2 charlie:3]

Verify: Attribute With Duplicate

map[alpha:2 charlie:3]

DurationSeconds slog.Duration() logs seconds instead of nanoseconds
Verify: Log Attributes

GroupWithTop ^WithGroup().With()^ ends up at top level of log record instead of in the group
Verify: Group With Top

LevelCase Log level in lowercase
Verify: Canceled Context

'info'

Verify: Canceled Context

'info'

Verify: Key Case

'debug'

Verify: Key Case

'info'

Verify: Key Case

'warn'

Verify: Key Case

'error'

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

2025-02-16T01:41:19Z