Skip to content

Releases: muonsoft/errors

v0.5.0

10 Feb 14:31

Choose a tag to compare

What's Changed

Native log/slog integration. This release replaces the custom field system with slog.Attr as the core type for error attributes. The logrus adapter has been removed.

Highlights

  • slog.Attr everywhere — Use slog.String(), slog.Int(), slog.Group(), etc. directly in errors.Wrap() and errors.Errorf() alongside existing options.
  • errors.Attrs(err) — Extract all attributes from an error chain for custom logging.
  • errors.Log(ctx, logger, err) — Log an error at Error level with attributes and stack trace.
  • errors.LogLevel(ctx, logger, level, err) — Same as above with an explicit level (Debug, Info, Warn, Error).
  • New attribute optionsInt64, Uint64, Float64, Any. Value is deprecated in favor of Any.
  • Grouped attributes — Full support for slog.Group in errors, JSON marshaling, and %+v formatting (dot notation).
  • slog.LogValuer — Errors implement LogValuer for native slog handling.

Breaking changes

  • Custom Field types and FieldLogger are removed; use slog.Attr and *slog.Logger.
  • LoggableError now requires Attrs() []slog.Attr instead of LogFields(FieldLogger).
  • errors.Log(err, logger) replaced by errors.Log(ctx, logger, err).
  • Package requires Go 1.21+.
  • logrus adapter removed — see migration guide for a small custom adapter if needed.

Migration

If you are upgrading from v0.4.x, read the Migration Guide for step-by-step instructions and before/after examples.

Full Changelog: v0.4.1...v0.5.0

v0.4.1

07 Sep 11:39
e81e607

Choose a tag to compare

What's Changed

Full Changelog: v0.4.0...v0.4.1

v0.4.0

09 Aug 14:45
e6d54eb

Choose a tag to compare

  • errors.Join() function added
  • errors.Stringer() option added
  • adopt errors wrapping behaviour to be consistent with multi errors introduced in go v1.20
  • minimal go version fixed to v1.20

v0.3.0

27 Jun 20:11

Choose a tag to compare

  • errors.IsOfType[T any](err error) function added
  • logrus adapter improvements

v0.2.0

19 Jun 12:48

Choose a tag to compare

  • errors.As() function based on typed parameters
  • fixes for logrus adapter
  • minimal required Go version is v1.18

v0.1.0

13 Jun 13:00

Choose a tag to compare

Initial version