Releases: uber-go/zap
exp/v0.3.0
0.3.0 - 22 Oct 2024
Breaking changes:
- #1339: zapslog: Drop
HandlerOptions
in favor ofHandlerOption
,
which uses the functional options pattern. - #1339: zapslog: Rename
AddSource
option toWithCaller
.
Enhancements:
- #1339: zapslog: Record stack traces for error logs or higher.
The newAddStackAt
option changes this level.
Bug fixes:
- #1344, #1408: zapslog: Comply fully with
slog.Handler
contract.
This includes ignoring emptyAttr
s, inliningGroup
s 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
WithLazy
method forSugaredLogger
. - #1399: zaptest: Add
NewTestingWriter
for customizing TestingWriter with more flexibility thanNewLogger
. - #1406: Add
Log
,Logw
,Logln
methods forSugaredLogger
. - #1416: Add
WithPanicHook
option for testing panic logs.
Thanks to @defval, @dimmo, @arxeiss, and @MKrupauskas for their contributions to this release.
v1.26.0
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/zapslog
package for integration with slog. - #1273: Add
Name
toLogger
which returns the Logger's name if one is set. - #1281: Add
zap/exp/expfield
package which contains helper methods
Str
andStrs
for 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.24.0
Enhancements:
- #1148: Add
Level
to bothLogger
andSugaredLogger
that reports the
current minimum enabled log level. - #1185:
SugaredLogger
turns errors to zap.Error automatically.
Thanks to @Abirdcfly, @craigpastro, @nnnkkk7, and @sashamelentyev for their
contributions to this release.
v1.23.0
v1.22.0
Enhancements:
- #1071: Add
zap.Objects
andzap.ObjectValues
field constructors to log
arrays of objects. With these two constructors, you don't need to implement
zapcore.ArrayMarshaler
for use withzap.Array
if those objects implement
zapcore.ObjectMarshaler
. - #1079: Add
SugaredLogger.WithOptions
to build a copy of an existing
SugaredLogger
with the provided options applied. - #1080: Add
*ln
variants toSugaredLogger
for each log level.
These functions provide a string joining behavior similar tofmt.Println
. - #1088: Add
zap.WithFatalHook
option to control the behavior of the
logger forFatal
-level log entries. This defaults to exiting the program. - #1108: Add a
zap.Must
function that you can use withNewProduction
or
NewDevelopment
to panic if the system was unable to build the logger. - #1118: Add a
Logger.Log
method 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
1.21.0 (7 Feb 2022)
Enhancements:
- #1047: Add
zapcore.ParseLevel
to parse aLevel
from a string. - #1048: Add
zap.ParseAtomicLevel
to parse anAtomicLevel
from a
string.
Bugfixes:
- #1058: Fix panic in JSON encoder when
EncodeLevel
is unset.
Other changes:
- #1052: Improve encoding performance when the
AddCaller
and
AddStacktrace
options are used together.
Thanks to @aerosol and @Techassi for their contributions to this release.
v1.20.0
Enhancements:
- #989: Add
EncoderConfig.SkipLineEnding
flag to disable adding newline
characters between log statements. - #1039: Add
EncoderConfig.NewReflectedEncoder
field 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
MarshalLogObject
methods when the methods return. - #1033: Avoid panicking in Sampler core if
thereafter
is zero.
Other changes:
- #1028: Drop support for Go < 1.15.
Thanks to @psrajat, @lruggieri, @sammyrnycreal for their contributions to this release.