Project: Cilium (Runtime / Cloud Native Network)
File: CHANGELOG.md

All notable changes to this project will be documented in this file. This project adheres to . Enhancements: : Add `WithLazy` method for `SugaredLogger`. : zaptest: Add `NewTestingWriter` for customizing TestingWriter with more flexibility than `NewLogger`. : Add `Log`, `Logw`, `Logln` methods for `SugaredLogger`. : Add `WithPanicHook` option for testing panic logs. Thanks to @defval, @dimmo, @arxeiss, and @MKrupauskas for their contributions to this release. Enhancements: : Add Dict as a Field. : Add `WithLazy` method to `Logger` which lazily evaluates the structured context. : String encoding is much (~50%) faster now. Thanks to @hhk7734, @jquirke, and @cdvr1993 for their contributions to this release. 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: : Add `zap/exp/zapslog` package for integration with slog. : Add `Name` to `Logger` which returns the Logger's name if one is set. : Add `zap/exp/expfield` package which contains helper methods `Str` and `Strs` for constructing String-like zap.Fields. : Reduce stack size on `Any`. Thanks to @knight42, @dzakaammar, @bcspragu, and @rexywork for their contributions to this release. Enhancements: : Add `Level` to both `Logger` and `SugaredLogger` that reports the current minimum enabled log level. : `SugaredLogger` turns errors to zap.Error automatically. Thanks to @Abirdcfly, @craigpastro, @nnnkkk7, and @sashamelentyev for their contributions to this release. Enhancements: : Add a `zapcore.LevelOf` function to determine the level of a `LevelEnabler` or `Core`. : Add `zap.Stringers` field constructor to log arrays of objects that implement `String() string`. Enhancements: : Add `zap.Objects` and `zap.ObjectValues` field constructors to log arrays of objects. With these two constructors, you don't need to implement `zapcore.ArrayMarshaler` for use with `zap.Array` if those objects implement `zapcore.ObjectMarshaler`. : Add `SugaredLogger.WithOptions` to build a copy of an existing `SugaredLogger` with the provided options applied. : Add `ln` variants to `SugaredLogger` for each log level. These functions provide a string joining behavior similar to `fmt.Println`. : Add `zap.WithFatalHook` option to control the behavior of the logger for `Fatal`-level log entries. This defaults to exiting the program. : Add a `zap.Must` function that you can use with `NewProduction` or `NewDevelopment` to panic if the system was unable to build the logger. : 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. Enhancements: : Add `zapcore.ParseLevel` to parse a `Level` from a string. : Add `zap.ParseAtomicLevel` to parse an `AtomicLevel` from a string. Bugfixes: : Fix panic in JSON encoder when `EncodeLevel` is unset. Other changes: : Improve encoding performance when the `AddCaller` and `AddStacktrace` options are used together. Thanks to @aerosol and @Techassi for their contributions to this release. Enhancements: : Add `EncoderConfig.SkipLineEnding` flag to disable adding newline characters between log statements. : Add `EncoderConfig.NewReflectedEncoder` field to customize JSON encoding of reflected log fields. Bugfixes: : Fix inaccurate precision when encoding complex64 as JSON. , : Close JSON namespaces opened in `MarshalLogObject` methods when the methods return. : Avoid panicking in Sampler core if `thereafter` is zero. Other changes: : Drop support for Go < 1.15. Thanks to @psrajat, @lruggieri, @sammyrnycreal for their contributions to this release. Bugfixes: : JSON: Fix complex number encoding with negative imaginary part. Thanks to @hemantjadon. : JSON: Fix inaccurate precision when encoding float32. Enhancements: : Avoid panicking in Sampler core if the level is out of bounds. : Reduce the size of BufferedWriteSyncer by aligning the fields

Thanks to @lancoLiu and @thockin for their contributions to this release. Bugfixes: : Fix nil dereference in logger constructed by `zap.NewNop`. Enhancements: : Add `zapcore.BufferedWriteSyncer`, a new `WriteSyncer` that buffers messages in-memory and flushes them periodically. : Add `zapio.Writer` to use a Zap logger as an `io.Writer`. : Add `zap.WithClock` option to control the source of time via the new `zapcore.Clock` interface. : Avoid panicking in `zap.SugaredLogger` when arguments of `w` methods don't match expectations. : Add support for filtering by level or arbitrary matcher function to `zaptest/observer`. : Comply with `io.StringWriter` and `io.ByteWriter` in Zap's `buffer.Buffer`. Thanks to @atrn0, @ernado, @heyanfu, @hnlq715, @zchee for their contributions to this release. Bugfixes: : Encode `<nil>` for nil `error` instead of a panic. , : Update minimum version constraints to address vulnerabilities in dependencies. Enhancements: : Improve alignment of fields of the Logger struct, reducing its size from 96 to 80 bytes. : Support `grpclog.LoggerV2` in zapgrpc. : Support URL-encoded POST requests to the AtomicLevel HTTP handler with the `application/x-www-form-urlencoded` content type. : Support multi-field encoding with `zap.Inline`. : Speed up SugaredLogger for calls with a single string. : 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. Bugfixes: : Fix missing newline in IncreaseLevel error messages. : Fix panic in JSON encoder when encoding times or durations without specifying a time or duration encoder. : Honor CallerSkip when taking stack traces. : Fix the default file permissions to use `0666` and rely on the umask instead. : Encode `<nil>` for nil `Stringer` instead of a panic error log. Enhancements: : Added `zapcore.TimeEncoderOfLayout` to easily create time encoders for custom layouts. : Added support for a configurable delimiter in the console encoder. : Optimize console encoder by pooling the underlying JSON encoder. : Add ability to include the calling function as part of logs. : Add `StackSkip` for including truncated stacks as a field. : 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. Bugfixes: : Fix handling of `Time` values out of `UnixNano` range. : Fix `IncreaseLevel` being reset after a call to `With`. Enhancements: : Add `WithCaller` option to supersede the `AddCaller` option. This allows disabling annotation of log entries with caller information if previously enabled with `AddCaller`. : Deprecate `NewSampler` constructor in favor of `NewSamplerWithOptions` which supports a `SamplerHook` option. This option adds support for monitoring sampling decisions through a hook. Thanks to @danielbprice for their contributions to this release. Bugfixes: : Fix panic on attempting to build a logger with an invalid Config. : Vendoring Zap with `go mod vendor` no longer includes Zap's development-time dependencies. : Fix issue introduced in 1.14.0 that caused invalid JSON output to be generated for arrays of `time.Time` objects when using string-based time formats. Thanks to @YashishDua for their contributions to this release. Enhancements: : Optimize calls for disabled log levels. : Add millisecond duration encoder. : Add option to increase the level of a logger. : Optimize time formatters using `Time.AppendFormat` where possible. Thanks to @caibirdme for their contributions to this release. Enhancements: : Add `Intp`, `Stringp`, and other similar `p` field constructors to log pointers to primitives with support for `nil` values. Thanks to @jbizzle for their contributions to this release. Enhancements: : Migrate to Go modules. Enhancements: : Add `zapcore.OmitKey` to omit keys in an `EncoderConfig`. : Add `RFC3339` and `RFC3339Nano` time

Thanks to @juicemia, @uhthomas for their contributions to this release. Bugfixes: : Fix `MapObjectEncoder.AppendByteString` not adding value as a string. : Fix incorrect call depth to determine caller in Go 1.12. Enhancements: : Add `zaptest.WrapOptions` to wrap `zap.Option` for creating test loggers. : Don't panic when encoding a String field. : 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. Bugfixes: : MapObjectEncoder should not ignore empty slices. Enhancements: : Reduce number of allocations when logging with reflection. , : Expose a registry for third-party logging sinks. Thanks to @nfarah86, @AlekSi, @JeanMertz, @philippgille, @etsangsplk, and @dimroc for their contributions to this release. Enhancements: : Make log level configurable when redirecting the standard library's logger. : Add a logger that writes to a `testing.TB`. : Add a top-level alias for `zapcore.Field` to clean up GoDoc. Bugfixes: : Add a missing import comment to `go.uber.org/zap/buffer`. Thanks to @DiSiqueira and @djui for their contributions to this release. Bugfixes: : Store strings when using AddByteString with the map encoder. Enhancements: : Add `NewStdLogAt`, which extends `NewStdLog` by allowing the user to specify the level of the logged messages. Enhancements: : Omit zap stack frames from stacktraces. : Add a `ContextMap` method to observer logs for simpler field validation in tests. Enhancements: and : Support errors produced by `go.uber.org/multierr`. : Support user-supplied encoders for logger names. Bugfixes: : Fix a bug that incorrectly truncated deep stacktraces. Thanks to @richard-tunein and @pavius for their contributions to this release. This release fixes two bugs. Bugfixes: : Support a variety of case conventions when unmarshaling levels. : Fix a panic in the observer. This release adds a few small features and is fully backward-compatible. Enhancements: : Add a `LineEnding` field to `EncoderConfig`, allowing users to override the Unix-style default. : Preserve time zones when logging times. : Make `zap.AtomicLevel` implement `fmt.Stringer`, which makes a variety of operations a bit simpler. 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: : Add a substring-filtering helper to zap's observer. This is particularly useful when testing the `SugaredLogger`. : Make `AtomicLevel` implement `encoding.TextMarshaler`. This release adds a gRPC compatibility wrapper. It is fully backward-compatible. Enhancements: : Add a `zapgrpc` package that wraps zap's Logger and implements `grpclog.Logger`. This release fixes two bugs and adds some enhancements to zap's testing helpers. It is fully backward-compatible. Bugfixes: : Fix caller path trimming on Windows. : Fix a panic when attempting to use non-existent directories with zap's configuration struct. Enhancements: : Add filtering helpers to zaptest's observing logger. Thanks to @moitias for contributing to this release. 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: : Add byte-oriented APIs to encoders to log UTF-8 encoded text without casting from `[]byte` to `string`. : To support buffering outputs, add `Sync` methods to `zapcore.Core`, `zap.Logger`, and `zap.SugaredLogger`. : Rename the `testutils` package to `zaptest`, which is less likely to clash with other testing helpers. Bugfixes: : Make the ISO8601 time formatters fixed-width, which is friendlier for tab-separated console output. : Remove the automatic locks in `zapcore.NewCore`, which allows zap to work with concurrency-safe `WriteSyncer` implementations. : Stop reporting errors when trying to `fsync` standard out on Linux systems. : Report the correct caller from zap's standard library interoperability

Enhancements: : Add a registry allowing third-party encodings to work with zap's built-in `Config`. : Make the representation of logger callers configurable (like times, levels, and durations). : Allow third-party encoders to use their own buffer pools, which removes the last performance advantage that zap's encoders have over plugins. : Add `CombineWriteSyncers`, a convenience function to tee multiple `WriteSyncer`s and lock the result. : Make zap's stacktraces compatible with mid-stack inlining (coming in Go 1.9). : 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. This is the third release candidate for zap's stable release. There are no breaking changes. Bugfixes: : Byte slices passed to `zap.Any` are now correctly treated as binary blobs rather than `[]uint8`. Enhancements: : Users can opt into colored output for log levels. : In addition to hijacking the output of the standard library's package-global logging functions, users can now construct a zap-backed `log.Logger` instance. : 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. This is the second release candidate for zap's stable release. It includes two breaking changes. Breaking changes: : Zap's global loggers are now fully concurrency-safe (previously, users had to ensure that `ReplaceGlobals` was called before the loggers were in use). However, they must now be accessed via the `L()` and `S()` functions. Users can update their projects with ``` gofmt -r "zap.L -> zap.L()" -w . gofmt -r "zap.S -> zap.S()" -w . ``` and : 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: : Redirecting the standard library's `log` output now correctly reports the logger's caller. Enhancements: and : Zap now transparently supports non-standard, rich errors like those produced by `github.com/pkg/errors`. : Though `New(nil)` continues to return a no-op logger, `NewNop()` is now preferred. Users can update their projects with `gofmt -r 'zap.New(nil) -> zap.NewNop()' -w .`. : Incorrectly importing zap as `github.com/uber-go/zap` now returns a more informative error. Thanks to @skipor and @chapsuk for their contributions to this release. 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"* &mdash; all users will need to update their code. User-facing types and functions remain in the `zap` package. Code relevant largely to extension authors is now in the `zapcore` package. The `zapcore.Core` type makes it easy for third-party packages to use zap's internals but provide a different user-facing API. `Logger` is now a concrete type instead of an interface. A less verbose (though slower) logging API is included by default. Package-global loggers `L` and `S` are 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. 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.