mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
rebase: update K8s packages to v0.32.1
Update K8s packages in go.mod to v0.32.1 Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
2
vendor/go.uber.org/zap/.golangci.yml
generated
vendored
2
vendor/go.uber.org/zap/.golangci.yml
generated
vendored
@ -17,7 +17,7 @@ linters:
|
||||
- unused
|
||||
|
||||
# Our own extras:
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- nolintlint # lints nolint directives
|
||||
- revive
|
||||
|
||||
|
10
vendor/go.uber.org/zap/.readme.tmpl
generated
vendored
10
vendor/go.uber.org/zap/.readme.tmpl
generated
vendored
@ -1,7 +1,15 @@
|
||||
# :zap: zap [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]
|
||||
|
||||
<div align="center">
|
||||
|
||||
Blazing fast, structured, leveled logging in Go.
|
||||
|
||||

|
||||
|
||||
[![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]
|
||||
|
||||
</div>
|
||||
|
||||
## Installation
|
||||
|
||||
`go get -u go.uber.org/zap`
|
||||
@ -92,7 +100,7 @@ standard.
|
||||
|
||||
<hr>
|
||||
|
||||
Released under the [MIT License](LICENSE.txt).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
<sup id="footnote-versions">1</sup> In particular, keep in mind that we may be
|
||||
benchmarking against slightly older versions of other packages. Versions are
|
||||
|
54
vendor/go.uber.org/zap/CHANGELOG.md
generated
vendored
54
vendor/go.uber.org/zap/CHANGELOG.md
generated
vendored
@ -3,14 +3,30 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 1.27.0 (20 Feb 2024)
|
||||
Enhancements:
|
||||
* [#1378][]: Add `WithLazy` method for `SugaredLogger`.
|
||||
* [#1399][]: zaptest: Add `NewTestingWriter` for customizing TestingWriter with more flexibility than `NewLogger`.
|
||||
* [#1406][]: Add `Log`, `Logw`, `Logln` methods for `SugaredLogger`.
|
||||
* [#1416][]: Add `WithPanicHook` option for testing panic logs.
|
||||
|
||||
Thanks to @defval, @dimmo, @arxeiss, and @MKrupauskas for their contributions to this release.
|
||||
|
||||
[#1378]: https://github.com/uber-go/zap/pull/1378
|
||||
[#1399]: https://github.com/uber-go/zap/pull/1399
|
||||
[#1406]: https://github.com/uber-go/zap/pull/1406
|
||||
[#1416]: https://github.com/uber-go/zap/pull/1416
|
||||
|
||||
## 1.26.0 (14 Sep 2023)
|
||||
Enhancements:
|
||||
* [#1297][]: Add Dict as a Field.
|
||||
* [#1319][]: Add `WithLazy` method to `Logger` which lazily evaluates the structured
|
||||
context.
|
||||
* [#1350][]: String encoding is much (~50%) faster now.
|
||||
|
||||
Thanks to @jquirke, @cdvr1993 for their contributions to this release.
|
||||
Thanks to @hhk7734, @jquirke, and @cdvr1993 for their contributions to this release.
|
||||
|
||||
[#1297]: https://github.com/uber-go/zap/pull/1297
|
||||
[#1319]: https://github.com/uber-go/zap/pull/1319
|
||||
[#1350]: https://github.com/uber-go/zap/pull/1350
|
||||
|
||||
@ -25,7 +41,7 @@ Enhancements:
|
||||
* [#1273][]: Add `Name` to `Logger` which returns the Logger's name if one is set.
|
||||
* [#1281][]: Add `zap/exp/expfield` package which contains helper methods
|
||||
`Str` and `Strs` for constructing String-like zap.Fields.
|
||||
* [#1310][]: Reduce stack size on `Any`.
|
||||
* [#1310][]: Reduce stack size on `Any`.
|
||||
|
||||
Thanks to @knight42, @dzakaammar, @bcspragu, and @rexywork for their contributions
|
||||
to this release.
|
||||
@ -352,7 +368,7 @@ to this release.
|
||||
[#675]: https://github.com/uber-go/zap/pull/675
|
||||
[#704]: https://github.com/uber-go/zap/pull/704
|
||||
|
||||
## v1.9.1 (06 Aug 2018)
|
||||
## 1.9.1 (06 Aug 2018)
|
||||
|
||||
Bugfixes:
|
||||
|
||||
@ -360,7 +376,7 @@ Bugfixes:
|
||||
|
||||
[#614]: https://github.com/uber-go/zap/pull/614
|
||||
|
||||
## v1.9.0 (19 Jul 2018)
|
||||
## 1.9.0 (19 Jul 2018)
|
||||
|
||||
Enhancements:
|
||||
* [#602][]: Reduce number of allocations when logging with reflection.
|
||||
@ -373,7 +389,7 @@ Thanks to @nfarah86, @AlekSi, @JeanMertz, @philippgille, @etsangsplk, and
|
||||
[#572]: https://github.com/uber-go/zap/pull/572
|
||||
[#606]: https://github.com/uber-go/zap/pull/606
|
||||
|
||||
## v1.8.0 (13 Apr 2018)
|
||||
## 1.8.0 (13 Apr 2018)
|
||||
|
||||
Enhancements:
|
||||
* [#508][]: Make log level configurable when redirecting the standard
|
||||
@ -391,14 +407,14 @@ Thanks to @DiSiqueira and @djui for their contributions to this release.
|
||||
[#577]: https://github.com/uber-go/zap/pull/577
|
||||
[#574]: https://github.com/uber-go/zap/pull/574
|
||||
|
||||
## v1.7.1 (25 Sep 2017)
|
||||
## 1.7.1 (25 Sep 2017)
|
||||
|
||||
Bugfixes:
|
||||
* [#504][]: Store strings when using AddByteString with the map encoder.
|
||||
|
||||
[#504]: https://github.com/uber-go/zap/pull/504
|
||||
|
||||
## v1.7.0 (21 Sep 2017)
|
||||
## 1.7.0 (21 Sep 2017)
|
||||
|
||||
Enhancements:
|
||||
|
||||
@ -407,7 +423,7 @@ Enhancements:
|
||||
|
||||
[#487]: https://github.com/uber-go/zap/pull/487
|
||||
|
||||
## v1.6.0 (30 Aug 2017)
|
||||
## 1.6.0 (30 Aug 2017)
|
||||
|
||||
Enhancements:
|
||||
|
||||
@ -418,7 +434,7 @@ Enhancements:
|
||||
[#490]: https://github.com/uber-go/zap/pull/490
|
||||
[#491]: https://github.com/uber-go/zap/pull/491
|
||||
|
||||
## v1.5.0 (22 Jul 2017)
|
||||
## 1.5.0 (22 Jul 2017)
|
||||
|
||||
Enhancements:
|
||||
|
||||
@ -436,7 +452,7 @@ Thanks to @richard-tunein and @pavius for their contributions to this release.
|
||||
[#460]: https://github.com/uber-go/zap/pull/460
|
||||
[#470]: https://github.com/uber-go/zap/pull/470
|
||||
|
||||
## v1.4.1 (08 Jun 2017)
|
||||
## 1.4.1 (08 Jun 2017)
|
||||
|
||||
This release fixes two bugs.
|
||||
|
||||
@ -448,7 +464,7 @@ Bugfixes:
|
||||
[#435]: https://github.com/uber-go/zap/pull/435
|
||||
[#444]: https://github.com/uber-go/zap/pull/444
|
||||
|
||||
## v1.4.0 (12 May 2017)
|
||||
## 1.4.0 (12 May 2017)
|
||||
|
||||
This release adds a few small features and is fully backward-compatible.
|
||||
|
||||
@ -464,7 +480,7 @@ Enhancements:
|
||||
[#425]: https://github.com/uber-go/zap/pull/425
|
||||
[#431]: https://github.com/uber-go/zap/pull/431
|
||||
|
||||
## v1.3.0 (25 Apr 2017)
|
||||
## 1.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.
|
||||
@ -478,7 +494,7 @@ Enhancements:
|
||||
[#415]: https://github.com/uber-go/zap/pull/415
|
||||
[#416]: https://github.com/uber-go/zap/pull/416
|
||||
|
||||
## v1.2.0 (13 Apr 2017)
|
||||
## 1.2.0 (13 Apr 2017)
|
||||
|
||||
This release adds a gRPC compatibility wrapper. It is fully backward-compatible.
|
||||
|
||||
@ -489,7 +505,7 @@ Enhancements:
|
||||
|
||||
[#402]: https://github.com/uber-go/zap/pull/402
|
||||
|
||||
## v1.1.0 (31 Mar 2017)
|
||||
## 1.1.0 (31 Mar 2017)
|
||||
|
||||
This release fixes two bugs and adds some enhancements to zap's testing helpers.
|
||||
It is fully backward-compatible.
|
||||
@ -510,7 +526,7 @@ Thanks to @moitias for contributing to this release.
|
||||
[#396]: https://github.com/uber-go/zap/pull/396
|
||||
[#386]: https://github.com/uber-go/zap/pull/386
|
||||
|
||||
## v1.0.0 (14 Mar 2017)
|
||||
## 1.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
|
||||
@ -569,7 +585,7 @@ contributions to this release.
|
||||
[#365]: https://github.com/uber-go/zap/pull/365
|
||||
[#372]: https://github.com/uber-go/zap/pull/372
|
||||
|
||||
## v1.0.0-rc.3 (7 Mar 2017)
|
||||
## 1.0.0-rc.3 (7 Mar 2017)
|
||||
|
||||
This is the third release candidate for zap's stable release. There are no
|
||||
breaking changes.
|
||||
@ -595,7 +611,7 @@ Thanks to @ansel1 and @suyash for their contributions to this release.
|
||||
[#353]: https://github.com/uber-go/zap/pull/353
|
||||
[#311]: https://github.com/uber-go/zap/pull/311
|
||||
|
||||
## v1.0.0-rc.2 (21 Feb 2017)
|
||||
## 1.0.0-rc.2 (21 Feb 2017)
|
||||
|
||||
This is the second release candidate for zap's stable release. It includes two
|
||||
breaking changes.
|
||||
@ -641,7 +657,7 @@ Thanks to @skipor and @chapsuk for their contributions to this release.
|
||||
[#326]: https://github.com/uber-go/zap/pull/326
|
||||
[#300]: https://github.com/uber-go/zap/pull/300
|
||||
|
||||
## v1.0.0-rc.1 (14 Feb 2017)
|
||||
## 1.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:
|
||||
@ -661,7 +677,7 @@ breaking changes and improvements from the pre-release version. Most notably:
|
||||
* Sampling is more accurate, and doesn't depend on the standard library's shared
|
||||
timer heap.
|
||||
|
||||
## v0.1.0-beta.1 (6 Feb 2017)
|
||||
## 0.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
|
||||
|
0
vendor/go.uber.org/zap/LICENSE.txt → vendor/go.uber.org/zap/LICENSE
generated
vendored
0
vendor/go.uber.org/zap/LICENSE.txt → vendor/go.uber.org/zap/LICENSE
generated
vendored
66
vendor/go.uber.org/zap/README.md
generated
vendored
66
vendor/go.uber.org/zap/README.md
generated
vendored
@ -1,7 +1,16 @@
|
||||
# :zap: zap [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]
|
||||
# :zap: zap
|
||||
|
||||
|
||||
<div align="center">
|
||||
|
||||
Blazing fast, structured, leveled logging in Go.
|
||||
|
||||

|
||||
|
||||
[![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]
|
||||
|
||||
</div>
|
||||
|
||||
## Installation
|
||||
|
||||
`go get -u go.uber.org/zap`
|
||||
@ -66,41 +75,44 @@ Log a message and 10 fields:
|
||||
|
||||
| Package | Time | Time % to zap | Objects Allocated |
|
||||
| :------ | :--: | :-----------: | :---------------: |
|
||||
| :zap: zap | 1744 ns/op | +0% | 5 allocs/op
|
||||
| :zap: zap (sugared) | 2483 ns/op | +42% | 10 allocs/op
|
||||
| zerolog | 918 ns/op | -47% | 1 allocs/op
|
||||
| go-kit | 5590 ns/op | +221% | 57 allocs/op
|
||||
| slog | 5640 ns/op | +223% | 40 allocs/op
|
||||
| apex/log | 21184 ns/op | +1115% | 63 allocs/op
|
||||
| logrus | 24338 ns/op | +1296% | 79 allocs/op
|
||||
| log15 | 26054 ns/op | +1394% | 74 allocs/op
|
||||
| :zap: zap | 656 ns/op | +0% | 5 allocs/op
|
||||
| :zap: zap (sugared) | 935 ns/op | +43% | 10 allocs/op
|
||||
| zerolog | 380 ns/op | -42% | 1 allocs/op
|
||||
| go-kit | 2249 ns/op | +243% | 57 allocs/op
|
||||
| slog (LogAttrs) | 2479 ns/op | +278% | 40 allocs/op
|
||||
| slog | 2481 ns/op | +278% | 42 allocs/op
|
||||
| apex/log | 9591 ns/op | +1362% | 63 allocs/op
|
||||
| log15 | 11393 ns/op | +1637% | 75 allocs/op
|
||||
| logrus | 11654 ns/op | +1677% | 79 allocs/op
|
||||
|
||||
Log a message with a logger that already has 10 fields of context:
|
||||
|
||||
| Package | Time | Time % to zap | Objects Allocated |
|
||||
| :------ | :--: | :-----------: | :---------------: |
|
||||
| :zap: zap | 193 ns/op | +0% | 0 allocs/op
|
||||
| :zap: zap (sugared) | 227 ns/op | +18% | 1 allocs/op
|
||||
| zerolog | 81 ns/op | -58% | 0 allocs/op
|
||||
| slog | 322 ns/op | +67% | 0 allocs/op
|
||||
| go-kit | 5377 ns/op | +2686% | 56 allocs/op
|
||||
| apex/log | 19518 ns/op | +10013% | 53 allocs/op
|
||||
| log15 | 19812 ns/op | +10165% | 70 allocs/op
|
||||
| logrus | 21997 ns/op | +11297% | 68 allocs/op
|
||||
| :zap: zap | 67 ns/op | +0% | 0 allocs/op
|
||||
| :zap: zap (sugared) | 84 ns/op | +25% | 1 allocs/op
|
||||
| zerolog | 35 ns/op | -48% | 0 allocs/op
|
||||
| slog | 193 ns/op | +188% | 0 allocs/op
|
||||
| slog (LogAttrs) | 200 ns/op | +199% | 0 allocs/op
|
||||
| go-kit | 2460 ns/op | +3572% | 56 allocs/op
|
||||
| log15 | 9038 ns/op | +13390% | 70 allocs/op
|
||||
| apex/log | 9068 ns/op | +13434% | 53 allocs/op
|
||||
| logrus | 10521 ns/op | +15603% | 68 allocs/op
|
||||
|
||||
Log a static string, without any context or `printf`-style templating:
|
||||
|
||||
| Package | Time | Time % to zap | Objects Allocated |
|
||||
| :------ | :--: | :-----------: | :---------------: |
|
||||
| :zap: zap | 165 ns/op | +0% | 0 allocs/op
|
||||
| :zap: zap (sugared) | 212 ns/op | +28% | 1 allocs/op
|
||||
| zerolog | 95 ns/op | -42% | 0 allocs/op
|
||||
| slog | 296 ns/op | +79% | 0 allocs/op
|
||||
| go-kit | 415 ns/op | +152% | 9 allocs/op
|
||||
| standard library | 422 ns/op | +156% | 2 allocs/op
|
||||
| apex/log | 1601 ns/op | +870% | 5 allocs/op
|
||||
| logrus | 3017 ns/op | +1728% | 23 allocs/op
|
||||
| log15 | 3469 ns/op | +2002% | 20 allocs/op
|
||||
| :zap: zap | 63 ns/op | +0% | 0 allocs/op
|
||||
| :zap: zap (sugared) | 81 ns/op | +29% | 1 allocs/op
|
||||
| zerolog | 32 ns/op | -49% | 0 allocs/op
|
||||
| standard library | 124 ns/op | +97% | 1 allocs/op
|
||||
| slog | 196 ns/op | +211% | 0 allocs/op
|
||||
| slog (LogAttrs) | 200 ns/op | +217% | 0 allocs/op
|
||||
| go-kit | 213 ns/op | +238% | 9 allocs/op
|
||||
| apex/log | 771 ns/op | +1124% | 5 allocs/op
|
||||
| logrus | 1439 ns/op | +2184% | 23 allocs/op
|
||||
| log15 | 2069 ns/op | +3184% | 20 allocs/op
|
||||
|
||||
## Development Status: Stable
|
||||
|
||||
@ -120,7 +132,7 @@ standard.
|
||||
|
||||
<hr>
|
||||
|
||||
Released under the [MIT License](LICENSE.txt).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
<sup id="footnote-versions">1</sup> In particular, keep in mind that we may be
|
||||
benchmarking against slightly older versions of other packages. Versions are
|
||||
|
2
vendor/go.uber.org/zap/buffer/buffer.go
generated
vendored
2
vendor/go.uber.org/zap/buffer/buffer.go
generated
vendored
@ -42,7 +42,7 @@ func (b *Buffer) AppendByte(v byte) {
|
||||
b.bs = append(b.bs, v)
|
||||
}
|
||||
|
||||
// AppendBytes writes a single byte to the Buffer.
|
||||
// AppendBytes writes the given slice of bytes to the Buffer.
|
||||
func (b *Buffer) AppendBytes(v []byte) {
|
||||
b.bs = append(b.bs, v...)
|
||||
}
|
||||
|
2
vendor/go.uber.org/zap/field.go
generated
vendored
2
vendor/go.uber.org/zap/field.go
generated
vendored
@ -460,6 +460,8 @@ func (d dictObject) MarshalLogObject(enc zapcore.ObjectEncoder) error {
|
||||
// - https://github.com/uber-go/zap/pull/1304
|
||||
// - https://github.com/uber-go/zap/pull/1305
|
||||
// - https://github.com/uber-go/zap/pull/1308
|
||||
//
|
||||
// See https://github.com/golang/go/issues/62077 for upstream issue.
|
||||
type anyFieldC[T any] func(string, T) Field
|
||||
|
||||
func (f anyFieldC[T]) Any(key string, val any) Field {
|
||||
|
39
vendor/go.uber.org/zap/logger.go
generated
vendored
39
vendor/go.uber.org/zap/logger.go
generated
vendored
@ -43,6 +43,7 @@ type Logger struct {
|
||||
|
||||
development bool
|
||||
addCaller bool
|
||||
onPanic zapcore.CheckWriteHook // default is WriteThenPanic
|
||||
onFatal zapcore.CheckWriteHook // default is WriteThenFatal
|
||||
|
||||
name string
|
||||
@ -345,27 +346,12 @@ func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry {
|
||||
// Set up any required terminal behavior.
|
||||
switch ent.Level {
|
||||
case zapcore.PanicLevel:
|
||||
ce = ce.After(ent, zapcore.WriteThenPanic)
|
||||
ce = ce.After(ent, terminalHookOverride(zapcore.WriteThenPanic, log.onPanic))
|
||||
case zapcore.FatalLevel:
|
||||
onFatal := log.onFatal
|
||||
// nil or WriteThenNoop will lead to continued execution after
|
||||
// a Fatal log entry, which is unexpected. For example,
|
||||
//
|
||||
// f, err := os.Open(..)
|
||||
// if err != nil {
|
||||
// log.Fatal("cannot open", zap.Error(err))
|
||||
// }
|
||||
// fmt.Println(f.Name())
|
||||
//
|
||||
// The f.Name() will panic if we continue execution after the
|
||||
// log.Fatal.
|
||||
if onFatal == nil || onFatal == zapcore.WriteThenNoop {
|
||||
onFatal = zapcore.WriteThenFatal
|
||||
}
|
||||
ce = ce.After(ent, onFatal)
|
||||
ce = ce.After(ent, terminalHookOverride(zapcore.WriteThenFatal, log.onFatal))
|
||||
case zapcore.DPanicLevel:
|
||||
if log.development {
|
||||
ce = ce.After(ent, zapcore.WriteThenPanic)
|
||||
ce = ce.After(ent, terminalHookOverride(zapcore.WriteThenPanic, log.onPanic))
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,3 +416,20 @@ func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry {
|
||||
|
||||
return ce
|
||||
}
|
||||
|
||||
func terminalHookOverride(defaultHook, override zapcore.CheckWriteHook) zapcore.CheckWriteHook {
|
||||
// A nil or WriteThenNoop hook will lead to continued execution after
|
||||
// a Panic or Fatal log entry, which is unexpected. For example,
|
||||
//
|
||||
// f, err := os.Open(..)
|
||||
// if err != nil {
|
||||
// log.Fatal("cannot open", zap.Error(err))
|
||||
// }
|
||||
// fmt.Println(f.Name())
|
||||
//
|
||||
// The f.Name() will panic if we continue execution after the log.Fatal.
|
||||
if override == nil || override == zapcore.WriteThenNoop {
|
||||
return defaultHook
|
||||
}
|
||||
return override
|
||||
}
|
||||
|
15
vendor/go.uber.org/zap/options.go
generated
vendored
15
vendor/go.uber.org/zap/options.go
generated
vendored
@ -132,6 +132,21 @@ func IncreaseLevel(lvl zapcore.LevelEnabler) Option {
|
||||
})
|
||||
}
|
||||
|
||||
// WithPanicHook sets a CheckWriteHook to run on Panic/DPanic logs.
|
||||
// Zap will call this hook after writing a log statement with a Panic/DPanic level.
|
||||
//
|
||||
// For example, the following builds a logger that will exit the current
|
||||
// goroutine after writing a Panic/DPanic log message, but it will not start a panic.
|
||||
//
|
||||
// zap.New(core, zap.WithPanicHook(zapcore.WriteThenGoexit))
|
||||
//
|
||||
// This is useful for testing Panic/DPanic log output.
|
||||
func WithPanicHook(hook zapcore.CheckWriteHook) Option {
|
||||
return optionFunc(func(log *Logger) {
|
||||
log.onPanic = hook
|
||||
})
|
||||
}
|
||||
|
||||
// OnFatal sets the action to take on fatal logs.
|
||||
//
|
||||
// Deprecated: Use [WithFatalHook] instead.
|
||||
|
39
vendor/go.uber.org/zap/sugar.go
generated
vendored
39
vendor/go.uber.org/zap/sugar.go
generated
vendored
@ -115,6 +115,21 @@ func (s *SugaredLogger) With(args ...interface{}) *SugaredLogger {
|
||||
return &SugaredLogger{base: s.base.With(s.sweetenFields(args)...)}
|
||||
}
|
||||
|
||||
// WithLazy adds a variadic number of fields to the logging context lazily.
|
||||
// The fields are evaluated only if the logger is further chained with [With]
|
||||
// or is written to with any of the log level methods.
|
||||
// Until that occurs, the logger may retain references to objects inside the fields,
|
||||
// and logging will reflect the state of an object at the time of logging,
|
||||
// not the time of WithLazy().
|
||||
//
|
||||
// Similar to [With], fields added to the child don't affect the parent,
|
||||
// and vice versa. Also, the keys in key-value pairs should be strings. In development,
|
||||
// passing a non-string key panics, while in production it logs an error and skips the pair.
|
||||
// Passing an orphaned key has the same behavior.
|
||||
func (s *SugaredLogger) WithLazy(args ...interface{}) *SugaredLogger {
|
||||
return &SugaredLogger{base: s.base.WithLazy(s.sweetenFields(args)...)}
|
||||
}
|
||||
|
||||
// Level reports the minimum enabled level for this logger.
|
||||
//
|
||||
// For NopLoggers, this is [zapcore.InvalidLevel].
|
||||
@ -122,6 +137,12 @@ func (s *SugaredLogger) Level() zapcore.Level {
|
||||
return zapcore.LevelOf(s.base.core)
|
||||
}
|
||||
|
||||
// Log logs the provided arguments at provided level.
|
||||
// Spaces are added between arguments when neither is a string.
|
||||
func (s *SugaredLogger) Log(lvl zapcore.Level, args ...interface{}) {
|
||||
s.log(lvl, "", args, nil)
|
||||
}
|
||||
|
||||
// Debug logs the provided arguments at [DebugLevel].
|
||||
// Spaces are added between arguments when neither is a string.
|
||||
func (s *SugaredLogger) Debug(args ...interface{}) {
|
||||
@ -165,6 +186,12 @@ func (s *SugaredLogger) Fatal(args ...interface{}) {
|
||||
s.log(FatalLevel, "", args, nil)
|
||||
}
|
||||
|
||||
// Logf formats the message according to the format specifier
|
||||
// and logs it at provided level.
|
||||
func (s *SugaredLogger) Logf(lvl zapcore.Level, template string, args ...interface{}) {
|
||||
s.log(lvl, template, args, nil)
|
||||
}
|
||||
|
||||
// Debugf formats the message according to the format specifier
|
||||
// and logs it at [DebugLevel].
|
||||
func (s *SugaredLogger) Debugf(template string, args ...interface{}) {
|
||||
@ -208,6 +235,12 @@ func (s *SugaredLogger) Fatalf(template string, args ...interface{}) {
|
||||
s.log(FatalLevel, template, args, nil)
|
||||
}
|
||||
|
||||
// Logw logs a message with some additional context. The variadic key-value
|
||||
// pairs are treated as they are in With.
|
||||
func (s *SugaredLogger) Logw(lvl zapcore.Level, msg string, keysAndValues ...interface{}) {
|
||||
s.log(lvl, msg, nil, keysAndValues)
|
||||
}
|
||||
|
||||
// Debugw logs a message with some additional context. The variadic key-value
|
||||
// pairs are treated as they are in With.
|
||||
//
|
||||
@ -255,6 +288,12 @@ func (s *SugaredLogger) Fatalw(msg string, keysAndValues ...interface{}) {
|
||||
s.log(FatalLevel, msg, nil, keysAndValues)
|
||||
}
|
||||
|
||||
// Logln logs a message at provided level.
|
||||
// Spaces are always added between arguments.
|
||||
func (s *SugaredLogger) Logln(lvl zapcore.Level, args ...interface{}) {
|
||||
s.logln(lvl, args, nil)
|
||||
}
|
||||
|
||||
// Debugln logs a message at [DebugLevel].
|
||||
// Spaces are always added between arguments.
|
||||
func (s *SugaredLogger) Debugln(args ...interface{}) {
|
||||
|
2
vendor/go.uber.org/zap/zapcore/console_encoder.go
generated
vendored
2
vendor/go.uber.org/zap/zapcore/console_encoder.go
generated
vendored
@ -77,7 +77,7 @@ func (c consoleEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer,
|
||||
// If this ever becomes a performance bottleneck, we can implement
|
||||
// ArrayEncoder for our plain-text format.
|
||||
arr := getSliceEncoder()
|
||||
if c.TimeKey != "" && c.EncodeTime != nil {
|
||||
if c.TimeKey != "" && c.EncodeTime != nil && !ent.Time.IsZero() {
|
||||
c.EncodeTime(ent.Time, arr)
|
||||
}
|
||||
if c.LevelKey != "" && c.EncodeLevel != nil {
|
||||
|
15
vendor/go.uber.org/zap/zapcore/encoder.go
generated
vendored
15
vendor/go.uber.org/zap/zapcore/encoder.go
generated
vendored
@ -37,6 +37,9 @@ const DefaultLineEnding = "\n"
|
||||
const OmitKey = ""
|
||||
|
||||
// A LevelEncoder serializes a Level to a primitive type.
|
||||
//
|
||||
// This function must make exactly one call
|
||||
// to a PrimitiveArrayEncoder's Append* method.
|
||||
type LevelEncoder func(Level, PrimitiveArrayEncoder)
|
||||
|
||||
// LowercaseLevelEncoder serializes a Level to a lowercase string. For example,
|
||||
@ -90,6 +93,9 @@ func (e *LevelEncoder) UnmarshalText(text []byte) error {
|
||||
}
|
||||
|
||||
// A TimeEncoder serializes a time.Time to a primitive type.
|
||||
//
|
||||
// This function must make exactly one call
|
||||
// to a PrimitiveArrayEncoder's Append* method.
|
||||
type TimeEncoder func(time.Time, PrimitiveArrayEncoder)
|
||||
|
||||
// EpochTimeEncoder serializes a time.Time to a floating-point number of seconds
|
||||
@ -219,6 +225,9 @@ func (e *TimeEncoder) UnmarshalJSON(data []byte) error {
|
||||
}
|
||||
|
||||
// A DurationEncoder serializes a time.Duration to a primitive type.
|
||||
//
|
||||
// This function must make exactly one call
|
||||
// to a PrimitiveArrayEncoder's Append* method.
|
||||
type DurationEncoder func(time.Duration, PrimitiveArrayEncoder)
|
||||
|
||||
// SecondsDurationEncoder serializes a time.Duration to a floating-point number of seconds elapsed.
|
||||
@ -262,6 +271,9 @@ func (e *DurationEncoder) UnmarshalText(text []byte) error {
|
||||
}
|
||||
|
||||
// A CallerEncoder serializes an EntryCaller to a primitive type.
|
||||
//
|
||||
// This function must make exactly one call
|
||||
// to a PrimitiveArrayEncoder's Append* method.
|
||||
type CallerEncoder func(EntryCaller, PrimitiveArrayEncoder)
|
||||
|
||||
// FullCallerEncoder serializes a caller in /full/path/to/package/file:line
|
||||
@ -292,6 +304,9 @@ func (e *CallerEncoder) UnmarshalText(text []byte) error {
|
||||
|
||||
// A NameEncoder serializes a period-separated logger name to a primitive
|
||||
// type.
|
||||
//
|
||||
// This function must make exactly one call
|
||||
// to a PrimitiveArrayEncoder's Append* method.
|
||||
type NameEncoder func(string, PrimitiveArrayEncoder)
|
||||
|
||||
// FullNameEncoder serializes the logger name as-is.
|
||||
|
2
vendor/go.uber.org/zap/zapcore/field.go
generated
vendored
2
vendor/go.uber.org/zap/zapcore/field.go
generated
vendored
@ -47,7 +47,7 @@ const (
|
||||
ByteStringType
|
||||
// Complex128Type indicates that the field carries a complex128.
|
||||
Complex128Type
|
||||
// Complex64Type indicates that the field carries a complex128.
|
||||
// Complex64Type indicates that the field carries a complex64.
|
||||
Complex64Type
|
||||
// DurationType indicates that the field carries a time.Duration.
|
||||
DurationType
|
||||
|
2
vendor/go.uber.org/zap/zapcore/json_encoder.go
generated
vendored
2
vendor/go.uber.org/zap/zapcore/json_encoder.go
generated
vendored
@ -372,7 +372,7 @@ func (enc *jsonEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer,
|
||||
final.AppendString(ent.Level.String())
|
||||
}
|
||||
}
|
||||
if final.TimeKey != "" {
|
||||
if final.TimeKey != "" && !ent.Time.IsZero() {
|
||||
final.AddTime(final.TimeKey, ent.Time)
|
||||
}
|
||||
if ent.LoggerName != "" && final.NameKey != "" {
|
||||
|
18
vendor/go.uber.org/zap/zapgrpc/zapgrpc.go
generated
vendored
18
vendor/go.uber.org/zap/zapgrpc/zapgrpc.go
generated
vendored
@ -36,16 +36,14 @@ const (
|
||||
grpcLvlFatal
|
||||
)
|
||||
|
||||
var (
|
||||
// _grpcToZapLevel maps gRPC log levels to zap log levels.
|
||||
// See https://pkg.go.dev/go.uber.org/zap@v1.16.0/zapcore#Level
|
||||
_grpcToZapLevel = map[int]zapcore.Level{
|
||||
grpcLvlInfo: zapcore.InfoLevel,
|
||||
grpcLvlWarn: zapcore.WarnLevel,
|
||||
grpcLvlError: zapcore.ErrorLevel,
|
||||
grpcLvlFatal: zapcore.FatalLevel,
|
||||
}
|
||||
)
|
||||
// _grpcToZapLevel maps gRPC log levels to zap log levels.
|
||||
// See https://pkg.go.dev/go.uber.org/zap@v1.16.0/zapcore#Level
|
||||
var _grpcToZapLevel = map[int]zapcore.Level{
|
||||
grpcLvlInfo: zapcore.InfoLevel,
|
||||
grpcLvlWarn: zapcore.WarnLevel,
|
||||
grpcLvlError: zapcore.ErrorLevel,
|
||||
grpcLvlFatal: zapcore.FatalLevel,
|
||||
}
|
||||
|
||||
// An Option overrides a Logger's default configuration.
|
||||
type Option interface {
|
||||
|
Reference in New Issue
Block a user