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