mirror of https://github.com/knative/caching.git
upgrade to latest dependencies (#839)
bumping google.golang.org/genproto/googleapis/rpc 31a09d3...012b6fc: > 012b6fc chore(all): update all (# 1086) bumping knative.dev/pkg 9f033a7...32e13c4: > 32e13c4 Bump github.com/prometheus/common from 0.47.0 to 0.48.0 (# 2975) > 7fe3d22 Bump google.golang.org/api from 0.165.0 to 0.167.0 (# 2973) > 7f542a9 Bump go.uber.org/zap from 1.26.0 to 1.27.0 (# 2972) > c97b609 upgrade to latest dependencies (# 2971) > 7594067 use shared setup-go and drop installation of go-licenses (# 2970) > bea8825 drop eventing-rabbitmq downstream testing (# 2969) > 695c421 drop http01 from downstream testing (# 2968) > 73aebb0 upgrade to latest dependencies (# 2967) bumping knative.dev/hack fe1f2b4...5f0998e: > 5f0998e Set default for GKE version to 1.28 (# 370) bumping github.com/prometheus/common 773d566...bd41eb6: > bd41eb6 Merge pull request # 576 from ywwg/owilliams/unexport > 05d7387 Unexport Format strings bumping go.uber.org/zap 96038b7...fcf8ee5: > fcf8ee5 Release v1.27.0 (# 1419) > e5a56ee Add WithPanicHook logger option for panic log tests (# 1416) > 0e2aa4e assets: Fix logo color profile (# 1418) > 956a21c Add methods for logging with level as argument (# 1406) > 2a893f6 build(deps): bump golangci/golangci-lint-action from 3 to 4 (# 1417) > e5745d6 ci: Test with Go 1.22 (# 1409) > 7db06bc zapslog: rename Option to HandlerOption (# 1411) > 35ded09 zapslog: fix all with slogtest, support inline group, ignore empty group. (# 1408) > 27b96e3 Make zaptest.NewTestingWriter public (# 1399) > 70f61bb zapslog: Bump zap from v1.24.0 to v1.26.0 (# 1404) > d27427d README: Add a logo (# 1396) > 5acd569 Rename license file to satisfy go docs for nested modules (# 1389) > fa1b6ae Extend WithLazy() method to SugaredLogger (# 1378) > f69ffe3 Update `Any` documentation to point at go compiler stack reuse issue (# 1387) > ad87f1e `zapcore/field.go`: Fixed typo on comment line indicating that the type is of complex64. (# 1386) > 628b1d0 Update goleak to 1.3.0 (# 1384) > f463774 lint: Pass zapcore and zaptest packages (# 1383) > 87577d8 zapcore: Ignore nil Entry.Time in encoders (# 1369) > 54430cb Revert "lint: Enable paralleltest, fix issues (# 1367)" (# 1368) > 7b6c114 lint: Enable paralleltest, fix issues (# 1367) > ed7ddb5 fmt: Prefer gofumpt over gofmt (# 1366) > 2f09c51 benchmark/slog: exp => std log/slog (# 1363) > 4ddf010 buffer: Fix AppendBytes doc string (# 1362) > 8a14570 doc: Clarify contract for primitive encoders (# 1360) > f9c5b00 chore(changelog): Drop 'v' prefixes (# 1356) > 6dce84f chore(exp/changelog): Use reference links (# 1357) > ebbc67a chore(changelog/1.26.0): add missing entry (# 1358) bumping google.golang.org/api e451477...548436b: > 548436b chore(main): release 0.167.0 (# 2428) > 55a9e5a feat(all): auto-regenerate discovery clients (# 2429) > f72b5af feat(all): auto-regenerate discovery clients (# 2427) > 133e58b chore(main): release 0.166.0 (# 2418) > 446a6bd feat(all): auto-regenerate discovery clients (# 2426) > b7d596b chore(all): update all (# 2423) > 124a535 feat(all): auto-regenerate discovery clients (# 2425) > b3f9c38 feat(all): auto-regenerate discovery clients (# 2424) > af6aa38 feat(all): auto-regenerate discovery clients (# 2421) > 762eb61 feat(all): auto-regenerate discovery clients (# 2420) > c969083 feat(all): auto-regenerate discovery clients (# 2419) > 260fc1e feat(all): auto-regenerate discovery clients (# 2417) Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
674b31b90f
commit
94c62a45c2
12
go.mod
12
go.mod
|
@ -5,14 +5,14 @@ go 1.21
|
|||
require (
|
||||
github.com/google/go-cmp v0.6.0
|
||||
github.com/hashicorp/golang-lru v1.0.2
|
||||
go.uber.org/zap v1.26.0
|
||||
go.uber.org/zap v1.27.0
|
||||
k8s.io/api v0.29.2
|
||||
k8s.io/apimachinery v0.29.2
|
||||
k8s.io/client-go v0.29.2
|
||||
k8s.io/code-generator v0.29.2
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
|
||||
knative.dev/hack v0.0.0-20240221160411-fe1f2b48a69a
|
||||
knative.dev/pkg v0.0.0-20240221065059-9f033a7b77f7
|
||||
knative.dev/hack v0.0.0-20240222141347-5f0998e65262
|
||||
knative.dev/pkg v0.0.0-20240226072014-32e13c4925ed
|
||||
)
|
||||
|
||||
require (
|
||||
|
@ -50,7 +50,7 @@ require (
|
|||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/prometheus/client_golang v1.18.0 // indirect
|
||||
github.com/prometheus/client_model v0.5.0 // indirect
|
||||
github.com/prometheus/common v0.47.0 // indirect
|
||||
github.com/prometheus/common v0.48.0 // indirect
|
||||
github.com/prometheus/procfs v0.12.0 // indirect
|
||||
github.com/prometheus/statsd_exporter v0.22.7 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
|
@ -66,10 +66,10 @@ require (
|
|||
golang.org/x/time v0.5.0 // indirect
|
||||
golang.org/x/tools v0.18.0 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
|
||||
google.golang.org/api v0.165.0 // indirect
|
||||
google.golang.org/api v0.167.0 // indirect
|
||||
google.golang.org/appengine v1.6.8 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 // indirect
|
||||
google.golang.org/grpc v1.61.1 // indirect
|
||||
google.golang.org/protobuf v1.32.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
|
|
32
go.sum
32
go.sum
|
@ -261,8 +261,8 @@ github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9
|
|||
github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
|
||||
github.com/prometheus/common v0.35.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
|
||||
github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
|
||||
github.com/prometheus/common v0.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpjL1k=
|
||||
github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc=
|
||||
github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE=
|
||||
github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
|
@ -310,14 +310,14 @@ go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
|
|||
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
|
||||
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
|
||||
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
|
||||
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
|
||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
|
@ -551,8 +551,8 @@ google.golang.org/api v0.25.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M
|
|||
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
||||
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
||||
google.golang.org/api v0.165.0 h1:zd5d4JIIIaYYsfVy1HzoXYZ9rWCSBxxAglbczzo7Bgc=
|
||||
google.golang.org/api v0.165.0/go.mod h1:2OatzO7ZDQsoS7IFf3rvsE17/TldiU3F/zxFHeqUB5o=
|
||||
google.golang.org/api v0.167.0 h1:CKHrQD1BLRii6xdkatBDXyKzM0mkawt2QP+H3LtPmSE=
|
||||
google.golang.org/api v0.167.0/go.mod h1:4FcBc686KFi7QI/U51/2GKKevfZMpM17sCdibqe/bSA=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
|
@ -592,12 +592,12 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
|
|||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20240125205218-1f4bbc51befe h1:USL2DhxfgRchafRvt/wYyyQNzwgL7ZiURcozOE/Pkvo=
|
||||
google.golang.org/genproto v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:cc8bqMqtv9gMOr0zHg2Vzff5ULhhL2IXP4sbcn32Dro=
|
||||
google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 h1:g/4bk7P6TPMkAUbUhquq98xey1slwvuVJPosdBqYJlU=
|
||||
google.golang.org/genproto v0.0.0-20240205150955-31a09d347014/go.mod h1:xEgQu1e4stdSSsxPDK8Azkrk/ECl5HvdPf6nbZrTS5M=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014 h1:x9PwdEgd11LgK+orcck69WVRo7DezSO4VUMPI4xpc8A=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014/go.mod h1:rbHMSEDyoYX62nRVLOCc4Qt1HbsdytAYoVwgjiOhF3I=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014 h1:FSL3lRCkhaPFxqi0s9o+V4UI2WTzAVOvkgbd4kVV4Wg=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014/go.mod h1:SaPjaZGWb0lPqs6Ittu0spdfrOArqji4ZdeP5IC/9N4=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 h1:hZB7eLIaYlW9qXRfCq/qDaPdbeY3757uARz5Vvfv+cY=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:YUWgXUFRPfoYK1IHMuxH5K6nPEXSCzIMljnQ59lLRCk=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
|
@ -674,10 +674,10 @@ k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/A
|
|||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
|
||||
k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ=
|
||||
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
knative.dev/hack v0.0.0-20240221160411-fe1f2b48a69a h1:ihHLVHm38G0Va1Y7onh8e9QRZc7lU5guLRa+cQsUZdE=
|
||||
knative.dev/hack v0.0.0-20240221160411-fe1f2b48a69a/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
|
||||
knative.dev/pkg v0.0.0-20240221065059-9f033a7b77f7 h1:OccHMomHYUHgNbpR6LCPC8oju6akEJCI0tymRdSMZus=
|
||||
knative.dev/pkg v0.0.0-20240221065059-9f033a7b77f7/go.mod h1:j4b62+hzLiXJ1NVavG5fjfvRk8CCNHFAdxLjeiAZPHI=
|
||||
knative.dev/hack v0.0.0-20240222141347-5f0998e65262 h1:QzYYQnuTjZAHamqbVLnaoxsa1bxfhpxM2AUhdfeL6qE=
|
||||
knative.dev/hack v0.0.0-20240222141347-5f0998e65262/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
|
||||
knative.dev/pkg v0.0.0-20240226072014-32e13c4925ed h1:qFYjYZ2qXXJsShVKW/6GAoYsQ3t8dV2DeRHl8/lFa84=
|
||||
knative.dev/pkg v0.0.0-20240226072014-32e13c4925ed/go.mod h1:02uFYWwWpfxrpWmI1vZqnXk1JZka/WVVw3kMLolAetw=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||
|
|
|
@ -45,7 +45,7 @@ func ResponseFormat(h http.Header) Format {
|
|||
|
||||
mediatype, params, err := mime.ParseMediaType(ct)
|
||||
if err != nil {
|
||||
return FmtUnknown
|
||||
return fmtUnknown
|
||||
}
|
||||
|
||||
const textType = "text/plain"
|
||||
|
@ -53,21 +53,21 @@ func ResponseFormat(h http.Header) Format {
|
|||
switch mediatype {
|
||||
case ProtoType:
|
||||
if p, ok := params["proto"]; ok && p != ProtoProtocol {
|
||||
return FmtUnknown
|
||||
return fmtUnknown
|
||||
}
|
||||
if e, ok := params["encoding"]; ok && e != "delimited" {
|
||||
return FmtUnknown
|
||||
return fmtUnknown
|
||||
}
|
||||
return FmtProtoDelim
|
||||
return fmtProtoDelim
|
||||
|
||||
case textType:
|
||||
if v, ok := params["version"]; ok && v != TextVersion {
|
||||
return FmtUnknown
|
||||
return fmtUnknown
|
||||
}
|
||||
return FmtText
|
||||
return fmtText
|
||||
}
|
||||
|
||||
return FmtUnknown
|
||||
return fmtUnknown
|
||||
}
|
||||
|
||||
// NewDecoder returns a new decoder based on the given input format.
|
||||
|
|
|
@ -76,18 +76,18 @@ func Negotiate(h http.Header) Format {
|
|||
if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol {
|
||||
switch ac.Params["encoding"] {
|
||||
case "delimited":
|
||||
return FmtProtoDelim + escapingScheme
|
||||
return fmtProtoDelim + escapingScheme
|
||||
case "text":
|
||||
return FmtProtoText + escapingScheme
|
||||
return fmtProtoText + escapingScheme
|
||||
case "compact-text":
|
||||
return FmtProtoCompact + escapingScheme
|
||||
return fmtProtoCompact + escapingScheme
|
||||
}
|
||||
}
|
||||
if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") {
|
||||
return FmtText + escapingScheme
|
||||
return fmtText + escapingScheme
|
||||
}
|
||||
}
|
||||
return FmtText + escapingScheme
|
||||
return fmtText + escapingScheme
|
||||
}
|
||||
|
||||
// NegotiateIncludingOpenMetrics works like Negotiate but includes
|
||||
|
@ -109,26 +109,26 @@ func NegotiateIncludingOpenMetrics(h http.Header) Format {
|
|||
if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol {
|
||||
switch ac.Params["encoding"] {
|
||||
case "delimited":
|
||||
return FmtProtoDelim + escapingScheme
|
||||
return fmtProtoDelim + escapingScheme
|
||||
case "text":
|
||||
return FmtProtoText + escapingScheme
|
||||
return fmtProtoText + escapingScheme
|
||||
case "compact-text":
|
||||
return FmtProtoCompact + escapingScheme
|
||||
return fmtProtoCompact + escapingScheme
|
||||
}
|
||||
}
|
||||
if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") {
|
||||
return FmtText + escapingScheme
|
||||
return fmtText + escapingScheme
|
||||
}
|
||||
if ac.Type+"/"+ac.SubType == OpenMetricsType && (ver == OpenMetricsVersion_0_0_1 || ver == OpenMetricsVersion_1_0_0 || ver == "") {
|
||||
switch ver {
|
||||
case OpenMetricsVersion_1_0_0:
|
||||
return FmtOpenMetrics_1_0_0 + escapingScheme
|
||||
return fmtOpenMetrics_1_0_0 + escapingScheme
|
||||
default:
|
||||
return FmtOpenMetrics_0_0_1 + escapingScheme
|
||||
return fmtOpenMetrics_0_0_1 + escapingScheme
|
||||
}
|
||||
}
|
||||
}
|
||||
return FmtText + escapingScheme
|
||||
return fmtText + escapingScheme
|
||||
}
|
||||
|
||||
// NewEncoder returns a new encoder based on content type negotiation. All
|
||||
|
|
|
@ -34,20 +34,21 @@ const (
|
|||
TextVersion = "0.0.4"
|
||||
ProtoType = `application/vnd.google.protobuf`
|
||||
ProtoProtocol = `io.prometheus.client.MetricFamily`
|
||||
ProtoFmt = ProtoType + "; proto=" + ProtoProtocol + ";"
|
||||
protoFmt = ProtoType + "; proto=" + ProtoProtocol + ";"
|
||||
OpenMetricsType = `application/openmetrics-text`
|
||||
OpenMetricsVersion_0_0_1 = "0.0.1"
|
||||
OpenMetricsVersion_1_0_0 = "1.0.0"
|
||||
|
||||
// The Content-Type values for the different wire protocols. Do not do direct
|
||||
// comparisons to these constants, instead use the comparison functions.
|
||||
FmtUnknown Format = `<unknown>`
|
||||
FmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8`
|
||||
FmtProtoDelim Format = ProtoFmt + ` encoding=delimited`
|
||||
FmtProtoText Format = ProtoFmt + ` encoding=text`
|
||||
FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text`
|
||||
FmtOpenMetrics_1_0_0 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_1_0_0 + `; charset=utf-8`
|
||||
FmtOpenMetrics_0_0_1 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_0_0_1 + `; charset=utf-8`
|
||||
// The Content-Type values for the different wire protocols. Note that these
|
||||
// values are now unexported. If code was relying on comparisons to these
|
||||
// constants, instead use FormatType().
|
||||
fmtUnknown Format = `<unknown>`
|
||||
fmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8`
|
||||
fmtProtoDelim Format = protoFmt + ` encoding=delimited`
|
||||
fmtProtoText Format = protoFmt + ` encoding=text`
|
||||
fmtProtoCompact Format = protoFmt + ` encoding=compact-text`
|
||||
fmtOpenMetrics_1_0_0 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_1_0_0 + `; charset=utf-8`
|
||||
fmtOpenMetrics_0_0_1 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_0_0_1 + `; charset=utf-8`
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -70,6 +71,26 @@ const (
|
|||
TypeOpenMetrics
|
||||
)
|
||||
|
||||
// NewFormat generates a new Format from the type provided. Mostly used for
|
||||
// tests, most Formats should be generated as part of content negotiation in
|
||||
// encode.go.
|
||||
func NewFormat(t FormatType) Format {
|
||||
switch t {
|
||||
case TypeProtoCompact:
|
||||
return fmtProtoCompact
|
||||
case TypeProtoDelim:
|
||||
return fmtProtoDelim
|
||||
case TypeProtoText:
|
||||
return fmtProtoText
|
||||
case TypeTextPlain:
|
||||
return fmtText
|
||||
case TypeOpenMetrics:
|
||||
return fmtOpenMetrics_1_0_0
|
||||
default:
|
||||
return fmtUnknown
|
||||
}
|
||||
}
|
||||
|
||||
// FormatType deduces an overall FormatType for the given format.
|
||||
func (f Format) FormatType() FormatType {
|
||||
toks := strings.Split(string(f), ";")
|
||||
|
|
|
@ -17,7 +17,7 @@ linters:
|
|||
- unused
|
||||
|
||||
# Our own extras:
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- nolintlint # lints nolint directives
|
||||
- revive
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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...)
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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{}) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 != "" {
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
|
||||
source "$(dirname "${BASH_SOURCE[0]:-$0}")/library.sh"
|
||||
|
||||
# Default Kubernetes version to use for GKE, if not overridden with
|
||||
# the `--cluster-version` parameter.
|
||||
readonly GKE_DEFAULT_CLUSTER_VERSION="1.28"
|
||||
|
||||
# Dumps the k8s api server metrics. Spins up a proxy, waits a little bit and
|
||||
# dumps the metrics to ${ARTIFACTS}/k8s.metrics.txt
|
||||
function dump_metrics() {
|
||||
|
@ -149,6 +153,9 @@ function create_gke_test_cluster() {
|
|||
if [[ ! " ${_custom_flags[*]} " =~ "--machine-type=" ]]; then
|
||||
_custom_flags+=("--machine-type=e2-standard-4")
|
||||
fi
|
||||
if [[ ! " ${_custom_flags[*]} " =~ "--cluster-version=" ]]; then
|
||||
_custom_flags+=("--cluster-version=${GKE_DEFAULT_CLUSTER_VERSION}")
|
||||
fi
|
||||
kubetest2 gke "${_custom_flags[@]}" \
|
||||
--rundir-in-artifacts \
|
||||
--up \
|
||||
|
|
|
@ -137,7 +137,7 @@ github.com/prometheus/client_golang/prometheus/promhttp
|
|||
# github.com/prometheus/client_model v0.5.0
|
||||
## explicit; go 1.19
|
||||
github.com/prometheus/client_model/go
|
||||
# github.com/prometheus/common v0.47.0
|
||||
# github.com/prometheus/common v0.48.0
|
||||
## explicit; go 1.20
|
||||
github.com/prometheus/common/expfmt
|
||||
github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg
|
||||
|
@ -176,7 +176,7 @@ go.opencensus.io/trace/tracestate
|
|||
# go.uber.org/multierr v1.11.0
|
||||
## explicit; go 1.19
|
||||
go.uber.org/multierr
|
||||
# go.uber.org/zap v1.26.0
|
||||
# go.uber.org/zap v1.27.0
|
||||
## explicit; go 1.19
|
||||
go.uber.org/zap
|
||||
go.uber.org/zap/buffer
|
||||
|
@ -241,7 +241,7 @@ golang.org/x/tools/internal/imports
|
|||
# gomodules.xyz/jsonpatch/v2 v2.4.0
|
||||
## explicit; go 1.20
|
||||
gomodules.xyz/jsonpatch/v2
|
||||
# google.golang.org/api v0.165.0
|
||||
# google.golang.org/api v0.167.0
|
||||
## explicit; go 1.19
|
||||
google.golang.org/api/support/bundler
|
||||
# google.golang.org/appengine v1.6.8
|
||||
|
@ -256,7 +256,7 @@ google.golang.org/appengine/urlfetch
|
|||
# google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014
|
||||
## explicit; go 1.19
|
||||
google.golang.org/genproto/googleapis/api/httpbody
|
||||
# google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014
|
||||
# google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9
|
||||
## explicit; go 1.19
|
||||
google.golang.org/genproto/googleapis/rpc/status
|
||||
# google.golang.org/grpc v1.61.1
|
||||
|
@ -690,10 +690,10 @@ k8s.io/utils/pointer
|
|||
k8s.io/utils/ptr
|
||||
k8s.io/utils/strings/slices
|
||||
k8s.io/utils/trace
|
||||
# knative.dev/hack v0.0.0-20240221160411-fe1f2b48a69a
|
||||
# knative.dev/hack v0.0.0-20240222141347-5f0998e65262
|
||||
## explicit; go 1.18
|
||||
knative.dev/hack
|
||||
# knative.dev/pkg v0.0.0-20240221065059-9f033a7b77f7
|
||||
# knative.dev/pkg v0.0.0-20240226072014-32e13c4925ed
|
||||
## explicit; go 1.21
|
||||
knative.dev/pkg/apis
|
||||
knative.dev/pkg/apis/duck
|
||||
|
|
Loading…
Reference in New Issue