23 KiB
Changelog
All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
1.24.0 (30 Nov 2022)
Enhancements:
- #1148: Add
Levelto bothLoggerandSugaredLoggerthat reports the current minimum enabled log level. - #1185:
SugaredLoggerturns errors to zap.Error automatically.
Thanks to @Abirdcfly, @craigpastro, @nnnkkk7, and @sashamelentyev for their contributions to this release.
1.23.0 (24 Aug 2022)
Enhancements:
- #1147: Add a
zapcore.LevelOffunction to determine the level of aLevelEnablerorCore. - #1155: Add
zap.Stringersfield constructor to log arrays of objects that implementString() string.
1.22.0 (8 Aug 2022)
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.
1.21.0 (7 Feb 2022)
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.
1.20.0 (4 Jan 2022)
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.
1.19.1 (8 Sep 2021)
Bugfixes:
- #1001: JSON: Fix complex number encoding with negative imaginary part. Thanks to @hemantjadon.
- #1003: JSON: Fix inaccurate precision when encoding float32.
1.19.0 (9 Aug 2021)
Enhancements:
- #975: Avoid panicking in Sampler core if the level is out of bounds.
- #984: Reduce the size of BufferedWriteSyncer by aligning the fields better.
Thanks to @lancoLiu and @thockin for their contributions to this release.
1.18.1 (28 Jun 2021)
Bugfixes:
- #974: Fix nil dereference in logger constructed by
zap.NewNop.
1.18.0 (28 Jun 2021)
Enhancements:
- #961: Add
zapcore.BufferedWriteSyncer, a newWriteSyncerthat buffers messages in-memory and flushes them periodically. - #971: Add
zapio.Writerto use a Zap logger as anio.Writer. - #897: Add
zap.WithClockoption to control the source of time via the newzapcore.Clockinterface. - #949: Avoid panicking in
zap.SugaredLoggerwhen arguments of*wmethods don't match expectations. - #943: Add support for filtering by level or arbitrary matcher function to
zaptest/observer. - #691: Comply with
io.StringWriterandio.ByteWriterin Zap'sbuffer.Buffer.
Thanks to @atrn0, @ernado, @heyanfu, @hnlq715, @zchee for their contributions to this release.
1.17.0 (25 May 2021)
Bugfixes:
- #867: Encode
<nil>for nilerrorinstead of a panic. - #931, #936: Update minimum version constraints to address vulnerabilities in dependencies.
Enhancements:
- #865: Improve alignment of fields of the Logger struct, reducing its size from 96 to 80 bytes.
- #881: Support
grpclog.LoggerV2in zapgrpc. - #903: Support URL-encoded POST requests to the AtomicLevel HTTP handler
with the
application/x-www-form-urlencodedcontent type. - #912: Support multi-field encoding with
zap.Inline. - #913: Speed up SugaredLogger for calls with a single string.
- #928: Add support for filtering by field name to
zaptest/observer.
Thanks to @ash2k, @FMLS, @jimmystewpot, @Oncilla, @tsoslow, @tylitianrui, @withshubh, and @wziww for their contributions to this release.
1.16.0 (1 Sep 2020)
Bugfixes:
- #828: Fix missing newline in IncreaseLevel error messages.
- #835: Fix panic in JSON encoder when encoding times or durations without specifying a time or duration encoder.
- #843: Honor CallerSkip when taking stack traces.
- #862: Fix the default file permissions to use
0666and rely on the umask instead. - #854: Encode
<nil>for nilStringerinstead of a panic error log.
Enhancements:
- #629: Added
zapcore.TimeEncoderOfLayoutto easily create time encoders for custom layouts. - #697: Added support for a configurable delimiter in the console encoder.
- #852: Optimize console encoder by pooling the underlying JSON encoder.
- #844: Add ability to include the calling function as part of logs.
- #843: Add
StackSkipfor including truncated stacks as a field. - #861: Add options to customize Fatal behaviour for better testability.
Thanks to @SteelPhase, @tmshn, @lixingwang, @wyxloading, @moul, @segevfiner, @andy-retailnext and @jcorbin for their contributions to this release.
1.15.0 (23 Apr 2020)
Bugfixes:
- #804: Fix handling of
Timevalues out ofUnixNanorange. - #812: Fix
IncreaseLevelbeing reset after a call toWith.
Enhancements:
- #806: Add
WithCalleroption to supersede theAddCalleroption. This allows disabling annotation of log entries with caller information if previously enabled withAddCaller. - #813: Deprecate
NewSamplerconstructor in favor ofNewSamplerWithOptionswhich supports aSamplerHookoption. This option adds support for monitoring sampling decisions through a hook.
Thanks to @danielbprice for their contributions to this release.
1.14.1 (14 Mar 2020)
Bugfixes:
- #791: Fix panic on attempting to build a logger with an invalid Config.
- #795: Vendoring Zap with
go mod vendorno longer includes Zap's development-time dependencies. - #799: Fix issue introduced in 1.14.0 that caused invalid JSON output to
be generated for arrays of
time.Timeobjects when using string-based time formats.
Thanks to @YashishDua for their contributions to this release.
1.14.0 (20 Feb 2020)
Enhancements:
- #771: Optimize calls for disabled log levels.
- #773: Add millisecond duration encoder.
- #775: Add option to increase the level of a logger.
- #786: Optimize time formatters using
Time.AppendFormatwhere possible.
Thanks to @caibirdme for their contributions to this release.
1.13.0 (13 Nov 2019)
Enhancements:
- #758: Add
Intp,Stringp, and other similar*pfield constructors to log pointers to primitives with support fornilvalues.
Thanks to @jbizzle for their contributions to this release.
1.12.0 (29 Oct 2019)
Enhancements:
- #751: Migrate to Go modules.
1.11.0 (21 Oct 2019)
Enhancements:
- #725: Add
zapcore.OmitKeyto omit keys in anEncoderConfig. - #736: Add
RFC3339andRFC3339Nanotime encoders.
Thanks to @juicemia, @uhthomas for their contributions to this release.
1.10.0 (29 Apr 2019)
Bugfixes:
- #657: Fix
MapObjectEncoder.AppendByteStringnot adding value as a string. - #706: Fix incorrect call depth to determine caller in Go 1.12.
Enhancements:
- #610: Add
zaptest.WrapOptionsto wrapzap.Optionfor creating test loggers. - #675: Don't panic when encoding a String field.
- #704: Disable HTML escaping for JSON objects encoded using the reflect-based encoder.
Thanks to @iaroslav-ciupin, @lelenanam, @joa, @NWilson for their contributions to this release.
v1.9.1 (06 Aug 2018)
Bugfixes:
- #614: MapObjectEncoder should not ignore empty slices.
v1.9.0 (19 Jul 2018)
Enhancements:
- #602: Reduce number of allocations when logging with reflection.
- #572, #606: Expose a registry for third-party logging sinks.
Thanks to @nfarah86, @AlekSi, @JeanMertz, @philippgille, @etsangsplk, and @dimroc for their contributions to this release.
v1.8.0 (13 Apr 2018)
Enhancements:
- #508: Make log level configurable when redirecting the standard library's logger.
- #518: Add a logger that writes to a
*testing.TB. - #577: Add a top-level alias for
zapcore.Fieldto clean up GoDoc.
Bugfixes:
- #574: Add a missing import comment to
go.uber.org/zap/buffer.
Thanks to @DiSiqueira and @djui for their contributions to this release.
v1.7.1 (25 Sep 2017)
Bugfixes:
- #504: Store strings when using AddByteString with the map encoder.
v1.7.0 (21 Sep 2017)
Enhancements:
- #487: Add
NewStdLogAt, which extendsNewStdLogby allowing the user to specify the level of the logged messages.
v1.6.0 (30 Aug 2017)
Enhancements:
- #491: Omit zap stack frames from stacktraces.
- #490: Add a
ContextMapmethod to observer logs for simpler field validation in tests.
v1.5.0 (22 Jul 2017)
Enhancements:
- #460 and #470: Support errors produced by
go.uber.org/multierr. - #465: Support user-supplied encoders for logger names.
Bugfixes:
- #477: Fix a bug that incorrectly truncated deep stacktraces.
Thanks to @richard-tunein and @pavius for their contributions to this release.
v1.4.1 (08 Jun 2017)
This release fixes two bugs.
Bugfixes:
- #435: Support a variety of case conventions when unmarshaling levels.
- #444: Fix a panic in the observer.
v1.4.0 (12 May 2017)
This release adds a few small features and is fully backward-compatible.
Enhancements:
- #424: Add a
LineEndingfield toEncoderConfig, allowing users to override the Unix-style default. - #425: Preserve time zones when logging times.
- #431: Make
zap.AtomicLevelimplementfmt.Stringer, which makes a variety of operations a bit simpler.
v1.3.0 (25 Apr 2017)
This release adds an enhancement to zap's testing helpers as well as the ability to marshal an AtomicLevel. It is fully backward-compatible.
Enhancements:
- #415: Add a substring-filtering helper to zap's observer. This is
particularly useful when testing the
SugaredLogger. - #416: Make
AtomicLevelimplementencoding.TextMarshaler.
v1.2.0 (13 Apr 2017)
This release adds a gRPC compatibility wrapper. It is fully backward-compatible.
Enhancements:
- #402: Add a
zapgrpcpackage that wraps zap's Logger and implementsgrpclog.Logger.
v1.1.0 (31 Mar 2017)
This release fixes two bugs and adds some enhancements to zap's testing helpers. It is fully backward-compatible.
Bugfixes:
- #385: Fix caller path trimming on Windows.
- #396: Fix a panic when attempting to use non-existent directories with zap's configuration struct.
Enhancements:
- #386: Add filtering helpers to zaptest's observing logger.
Thanks to @moitias for contributing to this release.
v1.0.0 (14 Mar 2017)
This is zap's first stable release. All exported APIs are now final, and no
further breaking changes will be made in the 1.x release series. Anyone using a
semver-aware dependency manager should now pin to ^1.
Breaking changes:
- #366: Add byte-oriented APIs to encoders to log UTF-8 encoded text without
casting from
[]bytetostring. - #364: To support buffering outputs, add
Syncmethods tozapcore.Core,zap.Logger, andzap.SugaredLogger. - #371: Rename the
testutilspackage tozaptest, which is less likely to clash with other testing helpers.
Bugfixes:
- #362: Make the ISO8601 time formatters fixed-width, which is friendlier for tab-separated console output.
- #369: Remove the automatic locks in
zapcore.NewCore, which allows zap to work with concurrency-safeWriteSyncerimplementations. - #347: Stop reporting errors when trying to
fsyncstandard out on Linux systems. - #373: Report the correct caller from zap's standard library interoperability wrappers.
Enhancements:
- #348: Add a registry allowing third-party encodings to work with zap's
built-in
Config. - #327: Make the representation of logger callers configurable (like times, levels, and durations).
- #376: Allow third-party encoders to use their own buffer pools, which removes the last performance advantage that zap's encoders have over plugins.
- #346: Add
CombineWriteSyncers, a convenience function to tee multipleWriteSyncers and lock the result. - #365: Make zap's stacktraces compatible with mid-stack inlining (coming in Go 1.9).
- #372: Export zap's observing logger as
zaptest/observer. This makes it easier for particularly punctilious users to unit test their application's logging.
Thanks to @suyash, @htrendev, @flisky, @Ulexus, and @skipor for their contributions to this release.
v1.0.0-rc.3 (7 Mar 2017)
This is the third release candidate for zap's stable release. There are no breaking changes.
Bugfixes:
- #339: Byte slices passed to
zap.Anyare now correctly treated as binary blobs rather than[]uint8.
Enhancements:
- #307: Users can opt into colored output for log levels.
- #353: In addition to hijacking the output of the standard library's
package-global logging functions, users can now construct a zap-backed
log.Loggerinstance. - #311: Frames from common runtime functions and some of zap's internal machinery are now omitted from stacktraces.
Thanks to @ansel1 and @suyash for their contributions to this release.
v1.0.0-rc.2 (21 Feb 2017)
This is the second release candidate for zap's stable release. It includes two breaking changes.
Breaking changes:
-
#316: Zap's global loggers are now fully concurrency-safe (previously, users had to ensure that
ReplaceGlobalswas called before the loggers were in use). However, they must now be accessed via theL()andS()functions. Users can update their projects withgofmt -r "zap.L -> zap.L()" -w . gofmt -r "zap.S -> zap.S()" -w . -
#309 and #317: RC1 was mistakenly shipped with invalid JSON and YAML struct tags on all config structs. This release fixes the tags and adds static analysis to prevent similar bugs in the future.
Bugfixes:
- #321: Redirecting the standard library's
logoutput now correctly reports the logger's caller.
Enhancements:
- #325 and #333: Zap now transparently supports non-standard, rich
errors like those produced by
github.com/pkg/errors. - #326: Though
New(nil)continues to return a no-op logger,NewNop()is now preferred. Users can update their projects withgofmt -r 'zap.New(nil) -> zap.NewNop()' -w .. - #300: Incorrectly importing zap as
github.com/uber-go/zapnow returns a more informative error.
Thanks to @skipor and @chapsuk for their contributions to this release.
v1.0.0-rc.1 (14 Feb 2017)
This is the first release candidate for zap's stable release. There are multiple breaking changes and improvements from the pre-release version. Most notably:
- Zap's import path is now "go.uber.org/zap" — all users will need to update their code.
- User-facing types and functions remain in the
zappackage. Code relevant largely to extension authors is now in thezapcorepackage. - The
zapcore.Coretype makes it easy for third-party packages to use zap's internals but provide a different user-facing API. Loggeris now a concrete type instead of an interface.- A less verbose (though slower) logging API is included by default.
- Package-global loggers
LandSare included. - A human-friendly console encoder is included.
- A declarative config struct allows common logger configurations to be managed as configuration instead of code.
- Sampling is more accurate, and doesn't depend on the standard library's shared timer heap.
v0.1.0-beta.1 (6 Feb 2017)
This is a minor version, tagged to allow users to pin to the pre-1.0 APIs and upgrade at their leisure. Since this is the first tagged release, there are no backward compatibility concerns and all functionality is new.
Early zap adopters should pin to the 0.1.x minor version until they're ready to upgrade to the upcoming stable release.