From 09a1d8a45f37fe1c85100dd2ea6860b0a89b9207 Mon Sep 17 00:00:00 2001 From: eats-ci Date: Wed, 14 Aug 2024 11:17:18 +0000 Subject: [PATCH] Bump dependencies --- src/go.mod | 4 +- src/go.sum | 8 +- .../code.cloudfoundry.org/lager/v3/README.md | 116 ++++-------------- .../lager/v3/internal/truncate/truncate.go | 14 ++- .../lager/v3/redacting_sink.go | 25 ++-- .../lager/v3/truncating_sink.go | 11 +- src/vendor/modules.txt | 6 +- 7 files changed, 59 insertions(+), 125 deletions(-) diff --git a/src/go.mod b/src/go.mod index ed49019c..554cffca 100644 --- a/src/go.mod +++ b/src/go.mod @@ -5,14 +5,14 @@ go 1.22.0 toolchain go1.22.6 require ( - code.cloudfoundry.org/lager/v3 v3.0.3 + code.cloudfoundry.org/lager/v3 v3.1.0 github.com/cloudfoundry-community/go-cfclient v0.0.0-20220930021109-9c4e6c59ccf1 github.com/cloudfoundry/sonde-go v0.0.0-20240807231527-361c7ad33dc7 // pinned github.com/onsi/gomega v1.34.1 ) require ( - code.cloudfoundry.org/tlsconfig v0.0.0-20240808182450-b1b581e211a2 + code.cloudfoundry.org/tlsconfig v0.1.0 github.com/alecthomas/kingpin/v2 v2.4.0 github.com/cloudfoundry/noaa/v2 v2.4.0 github.com/onsi/ginkgo/v2 v2.20.0 diff --git a/src/go.sum b/src/go.sum index 8a31f108..7852f53d 100644 --- a/src/go.sum +++ b/src/go.sum @@ -1,8 +1,8 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -code.cloudfoundry.org/lager/v3 v3.0.3 h1:/UTmadZfIaKuT/whEinSxK1mzRfNu1uPfvjFfGqiwzM= -code.cloudfoundry.org/lager/v3 v3.0.3/go.mod h1:Zn5q1SrIuuHjEUE7xerMKt3ztunrJQCZETAo7rV0CH8= -code.cloudfoundry.org/tlsconfig v0.0.0-20240808182450-b1b581e211a2 h1:KoCAuwi0tDa3JJW9qF6m7Fz5n6ftDx+yIVWEHgraRHw= -code.cloudfoundry.org/tlsconfig v0.0.0-20240808182450-b1b581e211a2/go.mod h1:6ymG8DjGLta+bnqdpUmdv88Ikje2VvOTq+8drVe4pUU= +code.cloudfoundry.org/lager/v3 v3.1.0 h1:ZB4VXLSI0bIWhDSjKdEh/Jrs2SXFLX/9+z2WEZhAf2o= +code.cloudfoundry.org/lager/v3 v3.1.0/go.mod h1:5KBxqCSNJBNf/RXCindvnyAKBWxTgMMO5mtn1qkMoEM= +code.cloudfoundry.org/tlsconfig v0.1.0 h1:/SGZk3K7t79cuhSVs/qZXayEnLV1kodmvU3EBcc4E4w= +code.cloudfoundry.org/tlsconfig v0.1.0/go.mod h1:6ymG8DjGLta+bnqdpUmdv88Ikje2VvOTq+8drVe4pUU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= diff --git a/src/vendor/code.cloudfoundry.org/lager/v3/README.md b/src/vendor/code.cloudfoundry.org/lager/v3/README.md index 9a4248ad..2b8facb7 100644 --- a/src/vendor/code.cloudfoundry.org/lager/v3/README.md +++ b/src/vendor/code.cloudfoundry.org/lager/v3/README.md @@ -1,102 +1,34 @@ -lager -===== +# lager -**Note**: This repository should be imported as `code.cloudfoundry.org/lager`. +[![Go Report +Card](https://goreportcard.com/badge/code.cloudfoundry.org/lager/v3)](https://goreportcard.com/report/code.cloudfoundry.org/lager/v3) +[![Go +Reference](https://pkg.go.dev/badge/code.cloudfoundry.org/lager.svg)](https://pkg.go.dev/code.cloudfoundry.org/lager/v3) -Lager is a logging library for go. +Lager is a logging library for go -## Usage +> \[!NOTE\] +> +> This repository should be imported as +> `code.cloudfoundry.org/lager/v3`. -Instantiate a logger with the name of your component. +# Docs -```go -import ( - "code.cloudfoundry.org/lager/v3" -) +- [Usage](./docs/usage.md) -logger := lager.NewLogger("my-app") -``` +# Contributing -### Lager and [`log/slog`](https://pkg.go.dev/log/slog) -Lager was written long before Go 1.21 introduced structured logging in the standard library. -There are some wrapper functions for interoperability between Lager and `slog`, -which are only available when using Go 1.21 and higher. +See the [Contributing.md](./.github/CONTRIBUTING.md) for more +information on how to contribute. -Lager can be used as an [`slog.Handler`](https://pkg.go.dev/log/slog#Handler) using the `NewHandler()` function: +# Working Group Charter -```go -func codeThatAcceptsSlog(l *slog.Logger) { ... } +This repository is maintained by [App Runtime +Platform](https://github.com/cloudfoundry/community/blob/main/toc/working-groups/app-runtime-platform.md) +under `Diego` area. -lagerLogger := lager.NewLogger("my-lager-logger") - -codeThatAcceptsSlog(slog.New(lager.NewHandler(lagerLogger))) -``` - -An `slog.Logger` can be used as a Lager `Sink` using the `NewSlogSink()` function: -```go -var *slog.Logger l = codeThatReturnsSlog() - -lagerLogger := lager.NewLogger("my-lager-logger") - -lagerLogger.RegisterSink(lager.NewSlogSink(l)) -``` - -### Sinks - -Lager can write logs to a variety of destinations. You can specify the destinations -using Lager sinks: - -To write to an arbitrary `Writer` object: - -```go -logger.RegisterSink(lager.NewWriterSink(myWriter, lager.INFO)) -``` - -### Emitting logs - -Lager supports the usual level-based logging, with an optional argument for arbitrary key-value data. - -```go -logger.Info("doing-stuff", lager.Data{ - "informative": true, -}) -``` - -output: -```json -{ "source": "my-app", "message": "doing-stuff", "data": { "informative": true }, "timestamp": 1232345, "log_level": 1 } -``` - -Error messages also take an `Error` object: - -```go -logger.Error("failed-to-do-stuff", errors.New("Something went wrong")) -``` - -output: -```json -{ "source": "my-app", "message": "failed-to-do-stuff", "data": { "error": "Something went wrong" }, "timestamp": 1232345, "log_level": 1 } -``` - -### Sessions - -You can avoid repetition of contextual data using 'Sessions': - -```go - -contextualLogger := logger.Session("my-task", lager.Data{ - "request-id": 5, -}) - -contextualLogger.Info("my-action") -``` - -output: - -```json -{ "source": "my-app", "message": "my-task.my-action", "data": { "request-id": 5 }, "timestamp": 1232345, "log_level": 1 } -``` - -## License - -Lager is [Apache 2.0](https://github.com/cloudfoundry/lager/blob/master/LICENSE) licensed. +> \[!IMPORTANT\] +> +> Content in this file is managed by the [CI task +> `sync-readme`](https://github.com/cloudfoundry/wg-app-platform-runtime-ci/blob/c83c224ad06515ed52f51bdadf6075f56300ec93/shared/tasks/sync-readme/metadata.yml) +> and is generated by CI following a convention. diff --git a/src/vendor/code.cloudfoundry.org/lager/v3/internal/truncate/truncate.go b/src/vendor/code.cloudfoundry.org/lager/v3/internal/truncate/truncate.go index f4fda22d..30ccf098 100644 --- a/src/vendor/code.cloudfoundry.org/lager/v3/internal/truncate/truncate.go +++ b/src/vendor/code.cloudfoundry.org/lager/v3/internal/truncate/truncate.go @@ -7,9 +7,10 @@ import ( // Value recursively walks through the value provided by `v` and truncates // any strings longer than `maxLength`. // Example: -// type foobar struct{A string; B string} -// truncate.Value(foobar{A:"foo",B:"bar"}, 20) == foobar{A:"foo",B:"bar"} -// truncate.Value(foobar{A:strings.Repeat("a", 25),B:"bar"}, 20) == foobar{A:"aaaaaaaa-(truncated)",B:"bar"} +// +// type foobar struct{A string; B string} +// truncate.Value(foobar{A:"foo",B:"bar"}, 20) == foobar{A:"foo",B:"bar"} +// truncate.Value(foobar{A:strings.Repeat("a", 25),B:"bar"}, 20) == foobar{A:"aaaaaaaa-(truncated)",B:"bar"} func Value(v interface{}, maxLength int) interface{} { rv := reflect.ValueOf(v) tv := truncateValue(rv, maxLength) @@ -158,9 +159,10 @@ const lenTruncated = len(truncated) // If the string is shorter than the string "-(truncated)" and the string // exceeds `maxLength`, the output will not be truncated. // Example: -// truncate.String(strings.Repeat("a", 25), 20) == "aaaaaaaa-(truncated)" -// truncate.String("foobar", 20) == "foobar" -// truncate.String("foobar", 5) == "foobar" +// +// truncate.String(strings.Repeat("a", 25), 20) == "aaaaaaaa-(truncated)" +// truncate.String("foobar", 20) == "foobar" +// truncate.String("foobar", 5) == "foobar" func String(s string, maxLength int) string { if maxLength <= 0 || len(s) < lenTruncated || len(s) <= maxLength { return s diff --git a/src/vendor/code.cloudfoundry.org/lager/v3/redacting_sink.go b/src/vendor/code.cloudfoundry.org/lager/v3/redacting_sink.go index 17a30295..37e18d1a 100644 --- a/src/vendor/code.cloudfoundry.org/lager/v3/redacting_sink.go +++ b/src/vendor/code.cloudfoundry.org/lager/v3/redacting_sink.go @@ -13,21 +13,20 @@ type redactingSink struct { // data field. The old behavior of NewRedactingWriterSink (which was removed // in v2) can be obtained using the following code: // -// redactingSink, err := NewRedactingSink( -// NewWriterSink(writer, minLogLevel), -// keyPatterns, -// valuePatterns, -// ) +// redactingSink, err := NewRedactingSink( +// NewWriterSink(writer, minLogLevel), +// keyPatterns, +// valuePatterns, +// ) // -// if err != nil { -// return nil, err -// } -// -// return NewReconfigurableSink( -// redactingSink, -// minLogLevel, -// ), nil +// if err != nil { +// return nil, err +// } // +// return NewReconfigurableSink( +// redactingSink, +// minLogLevel, +// ), nil func NewRedactingSink(sink Sink, keyPatterns []string, valuePatterns []string) (Sink, error) { jsonRedacter, err := NewJSONRedacter(keyPatterns, valuePatterns) if err != nil { diff --git a/src/vendor/code.cloudfoundry.org/lager/v3/truncating_sink.go b/src/vendor/code.cloudfoundry.org/lager/v3/truncating_sink.go index ba261fe7..79e4d5b4 100644 --- a/src/vendor/code.cloudfoundry.org/lager/v3/truncating_sink.go +++ b/src/vendor/code.cloudfoundry.org/lager/v3/truncating_sink.go @@ -10,11 +10,12 @@ type truncatingSink struct { // NewTruncatingSink returns a sink that truncates strings longer than the max // data string length // Example: -// writerSink := lager.NewWriterSink(os.Stdout, lager.INFO) -// sink := lager.NewTruncatingSink(testSink, 20) -// logger := lager.NewLogger("test") -// logger.RegisterSink(sink) -// logger.Info("message", lager.Data{"A": strings.Repeat("a", 25)}) +// +// writerSink := lager.NewWriterSink(os.Stdout, lager.INFO) +// sink := lager.NewTruncatingSink(testSink, 20) +// logger := lager.NewLogger("test") +// logger.RegisterSink(sink) +// logger.Info("message", lager.Data{"A": strings.Repeat("a", 25)}) func NewTruncatingSink(sink Sink, maxDataStringLength int) Sink { return &truncatingSink{ sink: sink, diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt index 1da22e1c..ba1dae19 100644 --- a/src/vendor/modules.txt +++ b/src/vendor/modules.txt @@ -1,8 +1,8 @@ -# code.cloudfoundry.org/lager/v3 v3.0.3 -## explicit; go 1.19 +# code.cloudfoundry.org/lager/v3 v3.1.0 +## explicit; go 1.20 code.cloudfoundry.org/lager/v3 code.cloudfoundry.org/lager/v3/internal/truncate -# code.cloudfoundry.org/tlsconfig v0.0.0-20240808182450-b1b581e211a2 +# code.cloudfoundry.org/tlsconfig v0.1.0 ## explicit; go 1.21 code.cloudfoundry.org/tlsconfig # github.com/Masterminds/semver v1.5.0