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