1# Changelog 2 3## 1.17.0 (25 May 2021) 4 5Bugfixes: 6* [#867][]: Encode `<nil>` for nil `error` instead of a panic. 7* [#931][], [#936][]: Update minimum version constraints to address 8 vulnerabilities in dependencies. 9 10Enhancements: 11* [#865][]: Improve alignment of fields of the Logger struct, reducing its 12 size from 96 to 80 bytes. 13* [#881][]: Support `grpclog.LoggerV2` in zapgrpc. 14* [#903][]: Support URL-encoded POST requests to the AtomicLevel HTTP handler 15 with the `application/x-www-form-urlencoded` content type. 16* [#912][]: Support multi-field encoding with `zap.Inline`. 17* [#913][]: Speed up SugaredLogger for calls with a single string. 18* [#928][]: Add support for filtering by field name to `zaptest/observer`. 19 20Thanks to @ash2k, @FMLS, @jimmystewpot, @Oncilla, @tsoslow, @tylitianrui, @withshubh, and @wziww for their contributions to this release. 21 22## 1.16.0 (1 Sep 2020) 23 24Bugfixes: 25* [#828][]: Fix missing newline in IncreaseLevel error messages. 26* [#835][]: Fix panic in JSON encoder when encoding times or durations 27 without specifying a time or duration encoder. 28* [#843][]: Honor CallerSkip when taking stack traces. 29* [#862][]: Fix the default file permissions to use `0666` and rely on the umask instead. 30* [#854][]: Encode `<nil>` for nil `Stringer` instead of a panic error log. 31 32Enhancements: 33* [#629][]: Added `zapcore.TimeEncoderOfLayout` to easily create time encoders 34 for custom layouts. 35* [#697][]: Added support for a configurable delimiter in the console encoder. 36* [#852][]: Optimize console encoder by pooling the underlying JSON encoder. 37* [#844][]: Add ability to include the calling function as part of logs. 38* [#843][]: Add `StackSkip` for including truncated stacks as a field. 39* [#861][]: Add options to customize Fatal behaviour for better testability. 40 41Thanks to @SteelPhase, @tmshn, @lixingwang, @wyxloading, @moul, @segevfiner, @andy-retailnext and @jcorbin for their contributions to this release. 42 43## 1.15.0 (23 Apr 2020) 44 45Bugfixes: 46* [#804][]: Fix handling of `Time` values out of `UnixNano` range. 47* [#812][]: Fix `IncreaseLevel` being reset after a call to `With`. 48 49Enhancements: 50* [#806][]: Add `WithCaller` option to supersede the `AddCaller` option. This 51 allows disabling annotation of log entries with caller information if 52 previously enabled with `AddCaller`. 53* [#813][]: Deprecate `NewSampler` constructor in favor of 54 `NewSamplerWithOptions` which supports a `SamplerHook` option. This option 55 adds support for monitoring sampling decisions through a hook. 56 57Thanks to @danielbprice for their contributions to this release. 58 59## 1.14.1 (14 Mar 2020) 60 61Bugfixes: 62* [#791][]: Fix panic on attempting to build a logger with an invalid Config. 63* [#795][]: Vendoring Zap with `go mod vendor` no longer includes Zap's 64 development-time dependencies. 65* [#799][]: Fix issue introduced in 1.14.0 that caused invalid JSON output to 66 be generated for arrays of `time.Time` objects when using string-based time 67 formats. 68 69Thanks to @YashishDua for their contributions to this release. 70 71## 1.14.0 (20 Feb 2020) 72 73Enhancements: 74* [#771][]: Optimize calls for disabled log levels. 75* [#773][]: Add millisecond duration encoder. 76* [#775][]: Add option to increase the level of a logger. 77* [#786][]: Optimize time formatters using `Time.AppendFormat` where possible. 78 79Thanks to @caibirdme for their contributions to this release. 80 81## 1.13.0 (13 Nov 2019) 82 83Enhancements: 84* [#758][]: Add `Intp`, `Stringp`, and other similar `*p` field constructors 85 to log pointers to primitives with support for `nil` values. 86 87Thanks to @jbizzle for their contributions to this release. 88 89## 1.12.0 (29 Oct 2019) 90 91Enhancements: 92* [#751][]: Migrate to Go modules. 93 94## 1.11.0 (21 Oct 2019) 95 96Enhancements: 97* [#725][]: Add `zapcore.OmitKey` to omit keys in an `EncoderConfig`. 98* [#736][]: Add `RFC3339` and `RFC3339Nano` time encoders. 99 100Thanks to @juicemia, @uhthomas for their contributions to this release. 101 102## 1.10.0 (29 Apr 2019) 103 104Bugfixes: 105* [#657][]: Fix `MapObjectEncoder.AppendByteString` not adding value as a 106 string. 107* [#706][]: Fix incorrect call depth to determine caller in Go 1.12. 108 109Enhancements: 110* [#610][]: Add `zaptest.WrapOptions` to wrap `zap.Option` for creating test 111 loggers. 112* [#675][]: Don't panic when encoding a String field. 113* [#704][]: Disable HTML escaping for JSON objects encoded using the 114 reflect-based encoder. 115 116Thanks to @iaroslav-ciupin, @lelenanam, @joa, @NWilson for their contributions 117to this release. 118 119## v1.9.1 (06 Aug 2018) 120 121Bugfixes: 122 123* [#614][]: MapObjectEncoder should not ignore empty slices. 124 125## v1.9.0 (19 Jul 2018) 126 127Enhancements: 128* [#602][]: Reduce number of allocations when logging with reflection. 129* [#572][], [#606][]: Expose a registry for third-party logging sinks. 130 131Thanks to @nfarah86, @AlekSi, @JeanMertz, @philippgille, @etsangsplk, and 132@dimroc for their contributions to this release. 133 134## v1.8.0 (13 Apr 2018) 135 136Enhancements: 137* [#508][]: Make log level configurable when redirecting the standard 138 library's logger. 139* [#518][]: Add a logger that writes to a `*testing.TB`. 140* [#577][]: Add a top-level alias for `zapcore.Field` to clean up GoDoc. 141 142Bugfixes: 143* [#574][]: Add a missing import comment to `go.uber.org/zap/buffer`. 144 145Thanks to @DiSiqueira and @djui for their contributions to this release. 146 147## v1.7.1 (25 Sep 2017) 148 149Bugfixes: 150* [#504][]: Store strings when using AddByteString with the map encoder. 151 152## v1.7.0 (21 Sep 2017) 153 154Enhancements: 155 156* [#487][]: Add `NewStdLogAt`, which extends `NewStdLog` by allowing the user 157 to specify the level of the logged messages. 158 159## v1.6.0 (30 Aug 2017) 160 161Enhancements: 162 163* [#491][]: Omit zap stack frames from stacktraces. 164* [#490][]: Add a `ContextMap` method to observer logs for simpler 165 field validation in tests. 166 167## v1.5.0 (22 Jul 2017) 168 169Enhancements: 170 171* [#460][] and [#470][]: Support errors produced by `go.uber.org/multierr`. 172* [#465][]: Support user-supplied encoders for logger names. 173 174Bugfixes: 175 176* [#477][]: Fix a bug that incorrectly truncated deep stacktraces. 177 178Thanks to @richard-tunein and @pavius for their contributions to this release. 179 180## v1.4.1 (08 Jun 2017) 181 182This release fixes two bugs. 183 184Bugfixes: 185 186* [#435][]: Support a variety of case conventions when unmarshaling levels. 187* [#444][]: Fix a panic in the observer. 188 189## v1.4.0 (12 May 2017) 190 191This release adds a few small features and is fully backward-compatible. 192 193Enhancements: 194 195* [#424][]: Add a `LineEnding` field to `EncoderConfig`, allowing users to 196 override the Unix-style default. 197* [#425][]: Preserve time zones when logging times. 198* [#431][]: Make `zap.AtomicLevel` implement `fmt.Stringer`, which makes a 199 variety of operations a bit simpler. 200 201## v1.3.0 (25 Apr 2017) 202 203This release adds an enhancement to zap's testing helpers as well as the 204ability to marshal an AtomicLevel. It is fully backward-compatible. 205 206Enhancements: 207 208* [#415][]: Add a substring-filtering helper to zap's observer. This is 209 particularly useful when testing the `SugaredLogger`. 210* [#416][]: Make `AtomicLevel` implement `encoding.TextMarshaler`. 211 212## v1.2.0 (13 Apr 2017) 213 214This release adds a gRPC compatibility wrapper. It is fully backward-compatible. 215 216Enhancements: 217 218* [#402][]: Add a `zapgrpc` package that wraps zap's Logger and implements 219 `grpclog.Logger`. 220 221## v1.1.0 (31 Mar 2017) 222 223This release fixes two bugs and adds some enhancements to zap's testing helpers. 224It is fully backward-compatible. 225 226Bugfixes: 227 228* [#385][]: Fix caller path trimming on Windows. 229* [#396][]: Fix a panic when attempting to use non-existent directories with 230 zap's configuration struct. 231 232Enhancements: 233 234* [#386][]: Add filtering helpers to zaptest's observing logger. 235 236Thanks to @moitias for contributing to this release. 237 238## v1.0.0 (14 Mar 2017) 239 240This is zap's first stable release. All exported APIs are now final, and no 241further breaking changes will be made in the 1.x release series. Anyone using a 242semver-aware dependency manager should now pin to `^1`. 243 244Breaking changes: 245 246* [#366][]: Add byte-oriented APIs to encoders to log UTF-8 encoded text without 247 casting from `[]byte` to `string`. 248* [#364][]: To support buffering outputs, add `Sync` methods to `zapcore.Core`, 249 `zap.Logger`, and `zap.SugaredLogger`. 250* [#371][]: Rename the `testutils` package to `zaptest`, which is less likely to 251 clash with other testing helpers. 252 253Bugfixes: 254 255* [#362][]: Make the ISO8601 time formatters fixed-width, which is friendlier 256 for tab-separated console output. 257* [#369][]: Remove the automatic locks in `zapcore.NewCore`, which allows zap to 258 work with concurrency-safe `WriteSyncer` implementations. 259* [#347][]: Stop reporting errors when trying to `fsync` standard out on Linux 260 systems. 261* [#373][]: Report the correct caller from zap's standard library 262 interoperability wrappers. 263 264Enhancements: 265 266* [#348][]: Add a registry allowing third-party encodings to work with zap's 267 built-in `Config`. 268* [#327][]: Make the representation of logger callers configurable (like times, 269 levels, and durations). 270* [#376][]: Allow third-party encoders to use their own buffer pools, which 271 removes the last performance advantage that zap's encoders have over plugins. 272* [#346][]: Add `CombineWriteSyncers`, a convenience function to tee multiple 273 `WriteSyncer`s and lock the result. 274* [#365][]: Make zap's stacktraces compatible with mid-stack inlining (coming in 275 Go 1.9). 276* [#372][]: Export zap's observing logger as `zaptest/observer`. This makes it 277 easier for particularly punctilious users to unit test their application's 278 logging. 279 280Thanks to @suyash, @htrendev, @flisky, @Ulexus, and @skipor for their 281contributions to this release. 282 283## v1.0.0-rc.3 (7 Mar 2017) 284 285This is the third release candidate for zap's stable release. There are no 286breaking changes. 287 288Bugfixes: 289 290* [#339][]: Byte slices passed to `zap.Any` are now correctly treated as binary blobs 291 rather than `[]uint8`. 292 293Enhancements: 294 295* [#307][]: Users can opt into colored output for log levels. 296* [#353][]: In addition to hijacking the output of the standard library's 297 package-global logging functions, users can now construct a zap-backed 298 `log.Logger` instance. 299* [#311][]: Frames from common runtime functions and some of zap's internal 300 machinery are now omitted from stacktraces. 301 302Thanks to @ansel1 and @suyash for their contributions to this release. 303 304## v1.0.0-rc.2 (21 Feb 2017) 305 306This is the second release candidate for zap's stable release. It includes two 307breaking changes. 308 309Breaking changes: 310 311* [#316][]: Zap's global loggers are now fully concurrency-safe 312 (previously, users had to ensure that `ReplaceGlobals` was called before the 313 loggers were in use). However, they must now be accessed via the `L()` and 314 `S()` functions. Users can update their projects with 315 316 ``` 317 gofmt -r "zap.L -> zap.L()" -w . 318 gofmt -r "zap.S -> zap.S()" -w . 319 ``` 320* [#309][] and [#317][]: RC1 was mistakenly shipped with invalid 321 JSON and YAML struct tags on all config structs. This release fixes the tags 322 and adds static analysis to prevent similar bugs in the future. 323 324Bugfixes: 325 326* [#321][]: Redirecting the standard library's `log` output now 327 correctly reports the logger's caller. 328 329Enhancements: 330 331* [#325][] and [#333][]: Zap now transparently supports non-standard, rich 332 errors like those produced by `github.com/pkg/errors`. 333* [#326][]: Though `New(nil)` continues to return a no-op logger, `NewNop()` is 334 now preferred. Users can update their projects with `gofmt -r 'zap.New(nil) -> 335 zap.NewNop()' -w .`. 336* [#300][]: Incorrectly importing zap as `github.com/uber-go/zap` now returns a 337 more informative error. 338 339Thanks to @skipor and @chapsuk for their contributions to this release. 340 341## v1.0.0-rc.1 (14 Feb 2017) 342 343This is the first release candidate for zap's stable release. There are multiple 344breaking changes and improvements from the pre-release version. Most notably: 345 346* **Zap's import path is now "go.uber.org/zap"** — all users will 347 need to update their code. 348* User-facing types and functions remain in the `zap` package. Code relevant 349 largely to extension authors is now in the `zapcore` package. 350* The `zapcore.Core` type makes it easy for third-party packages to use zap's 351 internals but provide a different user-facing API. 352* `Logger` is now a concrete type instead of an interface. 353* A less verbose (though slower) logging API is included by default. 354* Package-global loggers `L` and `S` are included. 355* A human-friendly console encoder is included. 356* A declarative config struct allows common logger configurations to be managed 357 as configuration instead of code. 358* Sampling is more accurate, and doesn't depend on the standard library's shared 359 timer heap. 360 361## v0.1.0-beta.1 (6 Feb 2017) 362 363This is a minor version, tagged to allow users to pin to the pre-1.0 APIs and 364upgrade at their leisure. Since this is the first tagged release, there are no 365backward compatibility concerns and all functionality is new. 366 367Early zap adopters should pin to the 0.1.x minor version until they're ready to 368upgrade to the upcoming stable release. 369 370[#316]: https://github.com/uber-go/zap/pull/316 371[#309]: https://github.com/uber-go/zap/pull/309 372[#317]: https://github.com/uber-go/zap/pull/317 373[#321]: https://github.com/uber-go/zap/pull/321 374[#325]: https://github.com/uber-go/zap/pull/325 375[#333]: https://github.com/uber-go/zap/pull/333 376[#326]: https://github.com/uber-go/zap/pull/326 377[#300]: https://github.com/uber-go/zap/pull/300 378[#339]: https://github.com/uber-go/zap/pull/339 379[#307]: https://github.com/uber-go/zap/pull/307 380[#353]: https://github.com/uber-go/zap/pull/353 381[#311]: https://github.com/uber-go/zap/pull/311 382[#366]: https://github.com/uber-go/zap/pull/366 383[#364]: https://github.com/uber-go/zap/pull/364 384[#371]: https://github.com/uber-go/zap/pull/371 385[#362]: https://github.com/uber-go/zap/pull/362 386[#369]: https://github.com/uber-go/zap/pull/369 387[#347]: https://github.com/uber-go/zap/pull/347 388[#373]: https://github.com/uber-go/zap/pull/373 389[#348]: https://github.com/uber-go/zap/pull/348 390[#327]: https://github.com/uber-go/zap/pull/327 391[#376]: https://github.com/uber-go/zap/pull/376 392[#346]: https://github.com/uber-go/zap/pull/346 393[#365]: https://github.com/uber-go/zap/pull/365 394[#372]: https://github.com/uber-go/zap/pull/372 395[#385]: https://github.com/uber-go/zap/pull/385 396[#396]: https://github.com/uber-go/zap/pull/396 397[#386]: https://github.com/uber-go/zap/pull/386 398[#402]: https://github.com/uber-go/zap/pull/402 399[#415]: https://github.com/uber-go/zap/pull/415 400[#416]: https://github.com/uber-go/zap/pull/416 401[#424]: https://github.com/uber-go/zap/pull/424 402[#425]: https://github.com/uber-go/zap/pull/425 403[#431]: https://github.com/uber-go/zap/pull/431 404[#435]: https://github.com/uber-go/zap/pull/435 405[#444]: https://github.com/uber-go/zap/pull/444 406[#477]: https://github.com/uber-go/zap/pull/477 407[#465]: https://github.com/uber-go/zap/pull/465 408[#460]: https://github.com/uber-go/zap/pull/460 409[#470]: https://github.com/uber-go/zap/pull/470 410[#487]: https://github.com/uber-go/zap/pull/487 411[#490]: https://github.com/uber-go/zap/pull/490 412[#491]: https://github.com/uber-go/zap/pull/491 413[#504]: https://github.com/uber-go/zap/pull/504 414[#508]: https://github.com/uber-go/zap/pull/508 415[#518]: https://github.com/uber-go/zap/pull/518 416[#577]: https://github.com/uber-go/zap/pull/577 417[#574]: https://github.com/uber-go/zap/pull/574 418[#602]: https://github.com/uber-go/zap/pull/602 419[#572]: https://github.com/uber-go/zap/pull/572 420[#606]: https://github.com/uber-go/zap/pull/606 421[#614]: https://github.com/uber-go/zap/pull/614 422[#657]: https://github.com/uber-go/zap/pull/657 423[#706]: https://github.com/uber-go/zap/pull/706 424[#610]: https://github.com/uber-go/zap/pull/610 425[#675]: https://github.com/uber-go/zap/pull/675 426[#704]: https://github.com/uber-go/zap/pull/704 427[#725]: https://github.com/uber-go/zap/pull/725 428[#736]: https://github.com/uber-go/zap/pull/736 429[#751]: https://github.com/uber-go/zap/pull/751 430[#758]: https://github.com/uber-go/zap/pull/758 431[#771]: https://github.com/uber-go/zap/pull/771 432[#773]: https://github.com/uber-go/zap/pull/773 433[#775]: https://github.com/uber-go/zap/pull/775 434[#786]: https://github.com/uber-go/zap/pull/786 435[#791]: https://github.com/uber-go/zap/pull/791 436[#795]: https://github.com/uber-go/zap/pull/795 437[#799]: https://github.com/uber-go/zap/pull/799 438[#804]: https://github.com/uber-go/zap/pull/804 439[#812]: https://github.com/uber-go/zap/pull/812 440[#806]: https://github.com/uber-go/zap/pull/806 441[#813]: https://github.com/uber-go/zap/pull/813 442[#629]: https://github.com/uber-go/zap/pull/629 443[#697]: https://github.com/uber-go/zap/pull/697 444[#828]: https://github.com/uber-go/zap/pull/828 445[#835]: https://github.com/uber-go/zap/pull/835 446[#843]: https://github.com/uber-go/zap/pull/843 447[#844]: https://github.com/uber-go/zap/pull/844 448[#852]: https://github.com/uber-go/zap/pull/852 449[#854]: https://github.com/uber-go/zap/pull/854 450[#861]: https://github.com/uber-go/zap/pull/861 451[#862]: https://github.com/uber-go/zap/pull/862 452[#865]: https://github.com/uber-go/zap/pull/865 453[#867]: https://github.com/uber-go/zap/pull/867 454[#881]: https://github.com/uber-go/zap/pull/881 455[#903]: https://github.com/uber-go/zap/pull/903 456[#912]: https://github.com/uber-go/zap/pull/912 457[#913]: https://github.com/uber-go/zap/pull/913 458[#928]: https://github.com/uber-go/zap/pull/928 459[#931]: https://github.com/uber-go/zap/pull/931 460[#936]: https://github.com/uber-go/zap/pull/936 461