Skip to content

Releases: go-coldbrew/log

v0.4.1

12 Apr 06:03

Choose a tag to compare

  • Add DefaultIsSet() — reports whether SetDefault was called explicitly
  • Used by core.SetupLogger to avoid overwriting a user-configured custom handler
  • Updated READMEs via gomarkdoc

v0.4.0

12 Apr 04:03
8a60b54

Choose a tag to compare

slog-native Handler with context field injection

Breaking changes

  • Removed backends: loggers/gokit, loggers/logrus, loggers/zap, loggers/stdlog, loggers/slog
  • Removed wrap/gokitwrap.go (ToGoKitLogger)
  • Removed direct deps: go-kit/log, logrus, zap
  • BaseLogger interface deprecated (kept for backward compat)
  • SetLogger, NewLogger deprecated — use SetDefault, NewHandler

New

  • Handler — custom slog.Handler with automatic context field injection, composable via WithAttrs/WithGroup
  • SetDefault(h) — sets global handler + slog.SetDefault so native slog.LogAttrs works
  • NewHandler(opts...) — creates Handler with default JSON/text output
  • NewHandlerWithInner(inner, opts...) — wraps any slog.Handler for composition
  • AddAttrsToContext(ctx, ...slog.Attr) — typed context fields, recovered at log time
  • ToSlogLevel / FromSlogLevel — exported level conversion
  • OverrideLogLevel now works with native slog calls
  • toAttr handles slog.Attr, slog.Value, time.Duration

Performance

  • 16B/1alloc per log call (down from 80B/3allocs)
  • Native slog path: ~551ns (30ns overhead over raw slog)

v0.3.2

09 Apr 07:20
a80f7ca

Choose a tag to compare

Cap slog group nesting depth at 10 levels, bump Go to 1.25.9

v0.3.1

04 Apr 15:01
8b3e312

Choose a tag to compare

perf: cache caller info by program counter in slog backend

v0.3.0

04 Apr 11:52

Choose a tag to compare

feat: refactor LogFields to use shared RequestContext from options, bump options to v0.3.0

v0.2.9

03 Apr 07:48
f3f914d

Choose a tag to compare

What's Changed

  • perf: replace sync.Map with RWMutex+map in LogFields — cheaper for write-few-read-once per-request pattern
  • perf: Range uses slice snapshot — cheaper than map copy for small field counts
  • fix: AddToLogContext guards against nil ctx
  • fix: lazy map init — zero-value LogFields is safe

v0.2.8

27 Mar 13:31
3573304

Choose a tag to compare

What's Changed

  • feat: add slog backend and handler bridge, switch default to slog by @ankurs in #19

Full Changelog: v0.2.7...v0.2.8

v0.2.7

26 Mar 01:26
913f258

Choose a tag to compare

What's Changed

  • Add Go example tests for pkg.go.dev by @ankurs in #15
  • chore: migrate to Go 1.24 tool directive by @ankurs in #16
  • feat: add SupportPackageIsVersion1 compile-time version sentinel by @ankurs in #17

Full Changelog: v0.2.6...v0.2.7

v0.2.6

22 Mar 14:42
d622e2c

Choose a tag to compare

What's Changed

  • chore: add CI linting, sync deps, fix lint issues by @ankurs in #13
  • feat: add log.AddToContext convenience wrapper by @ankurs in #14

Full Changelog: v0.2.5...v0.2.6

v0.2.5

20 Mar 02:33
14a39c4

Choose a tag to compare

What's Changed

  • chore: bump Go 1.23→1.25, remove godoc2ghmd, modernize to any by @ankurs in #12

Full Changelog: v0.2.4...v0.2.5