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

Score: 88.83
Benchmark Runs Ns/Op Allocs/Op Bytes/Op MB/Sec Score
Attributes 783,138 1,528.00 5 416 254.56 96.66
Big Group 19,582 56,917.00 532 12,892 457.88 96.08
Disabled 43,145,409 27.76 0 0 0.00 0.00
Key Values 783,554 1,478.00 5 416 263.28 96.98
Logging 39,344 30,099.00 51 1,635 275.49 97.54
Simple 3,221,114 377.60 1 32 193.32 95.57
Simple Source 2,001,231 620.40 3 280 172.47 94.04
With Attrs Attributes 829,318 1,457.00 5 417 505.88 98.00
With Attrs Key Values 738,121 1,519.00 5 416 485.15 97.97
With Attrs Simple 3,149,809 381.90 1 32 1,102.34 99.06
With Group Attributes 786,955 1,633.00 7 505 246.86 96.91
With Group Key Values 776,481 1,557.00 7 505 258.75 97.17

Benchmark Charts

chanchal/zaphandler Ns/Op chanchal/zaphandler Allocs/Op
chanchal/zaphandler Bytes/Op chanchal/zaphandler GB/Sec

Warnings

Score: 61.54
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

2024-05-19T01:15:07Z