Releases: veqryn/slog-context
v0.9.0
v0.8.0
v0.7.0
What's Changed
- Http middleware by @veqryn in #21
sloghttp.ExtractAttrCollectionextractor will automatically add to the log
record any attributes added bysloghttp.Withafter thesloghttp.AttrCollection
http middleware. This allows other middlewares to log with attributes that would
normally be out of scope, because they were added by a later middleware or the
final http handler in the chain.
Full Changelog: v0.6.0...v0.7.0
v0.6.0
v0.5.1
v0.5.0
Breaking Changes
Package function ToCtx renamed to NewCtx.
Package function Logger renamed to FromCtx.
Package renamed from slogcontext to slogctx.
To fix, change this:
import "github.com/veqryn/slog-context"
var h = slogcontext.NewHandler(slog.NewJSONHandler(os.Stdout, nil), nil)To this:
import "github.com/veqryn/slog-context"
var h = slogctx.NewHandler(slog.NewJSONHandler(os.Stdout, nil), nil)Named imports are unaffected.
v0.4.0
Added compatibility with Logr:
slog-context is now compatible with both standard library slog and with logr, which is an alternative logging api/interface/frontend.
If only slog is used, only *slog.Logger's will be stored in the context.
If both slog and logr are used, *slog.Logger will be automatically converted to a logr.Logger as needed, and vice versa. This allows full interoperability up and down the stack and with any libraries that use either slog-context or logr.
v0.3.0
Added a convenience method that allow the handler to be created as github.com/samber/slog-multi middleware, in order to easily setup slog workflows such as pipeslines, fanout, routing, failover, etc.