exp/v0.3.0
Breaking changes:
- #1339: zapslog: Drop
HandlerOptionsin favor ofHandlerOption, which uses the functional options pattern. - #1339: zapslog: Rename
AddSourceoption toWithCaller.
Enhancements:
- #1339: zapslog: Record stack traces for error logs or higher. The new
AddStackAtoption changes this level.
Bug fixes:
- #1344, #1408: zapslog: Comply fully with
slog.Handlercontract. This includes ignoring emptyAttrs, inliningGroups with empty names, and omitting groups with no attributes.
Thanks to @zekth and @arukiidou for their contributions to this release.
v1.27.0
Enhancements:
- #1378: Add
WithLazymethod forSugaredLogger. - #1399: zaptest: Add
NewTestingWriterfor customizing TestingWriter with more flexibility thanNewLogger. - #1406: Add
Log,Logw,Loglnmethods forSugaredLogger. - #1416: Add
WithPanicHookoption for testing panic logs.
Thanks to @defval, @dimmo, @arxeiss, and @MKrupauskas for their contributions to this release.
v1.25.0
This release contains several improvements including performance, API additions, and two new experimental packages whose APIs are unstable and may change in the future.
Enhancements:
- #1246: Add
zap/exp/zapslogpackage for integration with slog. - #1273: Add
NametoLoggerwhich returns the Logger's name if one is set. - #1281: Add
zap/exp/expfieldpackage which contains helper methodsStrandStrsfor constructing String-like zap.Fields. - #1310: Reduce stack size on
Any.
Thanks to @knight42, @dzakaammar, @bcspragu, and @rexywork for their contributions to this release.
v1.22.0
Enhancements:
- #1071: Add
zap.Objectsandzap.ObjectValuesfield constructors to log arrays of objects. With these two constructors, you don't need to implementzapcore.ArrayMarshalerfor use withzap.Arrayif those objects implementzapcore.ObjectMarshaler. - #1079: Add
SugaredLogger.WithOptionsto build a copy of an existingSugaredLoggerwith the provided options applied. - #1080: Add
*lnvariants toSugaredLoggerfor each log level. These functions provide a string joining behavior similar tofmt.Println. - #1088: Add
zap.WithFatalHookoption to control the behavior of the logger forFatal-level log entries. This defaults to exiting the program. - #1108: Add a
zap.Mustfunction that you can use withNewProductionorNewDevelopmentto panic if the system was unable to build the logger. - #1118: Add a
Logger.Logmethod that allows specifying the log level for a statement dynamically.
Thanks to @cardil, @craigpastro, @sashamelentyev, @shota3506, and @zhupeijun for their contributions to this release.
v1.21.0
Enhancements:
- #1047: Add
zapcore.ParseLevelto parse aLevelfrom a string. - #1048: Add
zap.ParseAtomicLevelto parse anAtomicLevelfrom a string.
Bugfixes:
- #1058: Fix panic in JSON encoder when
EncodeLevelis unset.
Other changes:
- #1052: Improve encoding performance when the
AddCallerandAddStacktraceoptions are used together.
Thanks to @aerosol and @Techassi for their contributions to this release.
v1.20.0
Enhancements:
- #989: Add
EncoderConfig.SkipLineEndingflag to disable adding newline characters between log statements. - #1039: Add
EncoderConfig.NewReflectedEncoderfield to customize JSON encoding of reflected log fields.
Bugfixes:
- #1011: Fix inaccurate precision when encoding complex64 as JSON.
- #554, #1017: Close JSON namespaces opened in
MarshalLogObjectmethods when the methods return. - #1033: Avoid panicking in Sampler core if
thereafteris zero.
Other changes:
- #1028: Drop support for Go < 1.15.
Thanks to @psrajat, @lruggieri, @sammyrnycreal for their contributions to this release.