aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/cloud.google.com
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-07-21 10:47:36 +0000
committerTaras Madan <tarasmadan@google.com>2023-07-24 06:22:17 +0000
commit68162649cfb33009e4bbd0c7c5ca0dd17e375bff (patch)
tree2f426fda07d4a26c21911b5b0f897b7099102198 /vendor/cloud.google.com
parent27cbe77f4f2a8de98c3d540ef77796263555fe6b (diff)
mod: do: bump cloud.google.com/go/logging from 1.6.1 to 1.7.0
Bumps [cloud.google.com/go/logging](https://github.com/googleapis/google-cloud-go) from 1.6.1 to 1.7.0. - [Release notes](https://github.com/googleapis/google-cloud-go/releases) - [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/documentai/CHANGES.md) - [Commits](https://github.com/googleapis/google-cloud-go/compare/iot/v1.6.1...dlp/v1.7.0) --- updated-dependencies: - dependency-name: cloud.google.com/go/logging dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
Diffstat (limited to 'vendor/cloud.google.com')
-rw-r--r--vendor/cloud.google.com/go/logging/CHANGES.md15
-rw-r--r--vendor/cloud.google.com/go/logging/README.md2
-rw-r--r--vendor/cloud.google.com/go/logging/apiv2/config_client.go4
-rw-r--r--vendor/cloud.google.com/go/logging/apiv2/doc.go12
-rw-r--r--vendor/cloud.google.com/go/logging/apiv2/logging_client.go4
-rw-r--r--vendor/cloud.google.com/go/logging/apiv2/metrics_client.go4
-rw-r--r--vendor/cloud.google.com/go/logging/apiv2/version.go2
-rw-r--r--vendor/cloud.google.com/go/logging/instrumentation.go2
-rw-r--r--vendor/cloud.google.com/go/logging/internal/version.go2
-rw-r--r--vendor/cloud.google.com/go/logging/logadmin/logadmin.go2
-rw-r--r--vendor/cloud.google.com/go/logging/logadmin/metrics.go2
-rw-r--r--vendor/cloud.google.com/go/logging/logadmin/resources.go2
-rw-r--r--vendor/cloud.google.com/go/logging/logadmin/sinks.go2
-rw-r--r--vendor/cloud.google.com/go/logging/logging.go50
14 files changed, 73 insertions, 32 deletions
diff --git a/vendor/cloud.google.com/go/logging/CHANGES.md b/vendor/cloud.google.com/go/logging/CHANGES.md
index c62dd3cc7..a5c037c1c 100644
--- a/vendor/cloud.google.com/go/logging/CHANGES.md
+++ b/vendor/cloud.google.com/go/logging/CHANGES.md
@@ -1,5 +1,20 @@
# Changes
+## [1.7.0](https://github.com/googleapis/google-cloud-go/compare/logging/v1.6.1...logging/v1.7.0) (2023-02-27)
+
+
+### Features
+
+* **logging:** Add (*Logger). StandardLoggerFromTemplate() method. ([#7261](https://github.com/googleapis/google-cloud-go/issues/7261)) ([533ecbb](https://github.com/googleapis/google-cloud-go/commit/533ecbb19a2833e667ad139a6604fd40dfb43cdc))
+* **logging:** Add REST client ([06a54a1](https://github.com/googleapis/google-cloud-go/commit/06a54a16a5866cce966547c51e203b9e09a25bc0))
+* **logging:** Rewrite signatures and type in terms of new location ([620e6d8](https://github.com/googleapis/google-cloud-go/commit/620e6d828ad8641663ae351bfccfe46281e817ad))
+
+
+### Bug Fixes
+
+* **logging:** Correctly populate SourceLocation when logging via (*Logger).StandardLogger ([#7320](https://github.com/googleapis/google-cloud-go/issues/7320)) ([1a0bd13](https://github.com/googleapis/google-cloud-go/commit/1a0bd13b88569826f4ee6528e9cdb59fd26914fa))
+* **logging:** Fix typo in README.md ([#7297](https://github.com/googleapis/google-cloud-go/issues/7297)) ([82aa2ee](https://github.com/googleapis/google-cloud-go/commit/82aa2ee9381f793bd731f1b6789fc18e4b671bd7))
+
## [1.6.1](https://github.com/googleapis/google-cloud-go/compare/logging/v1.6.0...logging/v1.6.1) (2022-12-02)
diff --git a/vendor/cloud.google.com/go/logging/README.md b/vendor/cloud.google.com/go/logging/README.md
index 0de922f51..d1fb9ec28 100644
--- a/vendor/cloud.google.com/go/logging/README.md
+++ b/vendor/cloud.google.com/go/logging/README.md
@@ -60,6 +60,6 @@ Creating a Logger using `logging.Logger` accept configuration [LoggerOption](log
| EntryByteLimit | `int` | Maximum size in bytes of the single write call to ingest log entries. If EntryByteLimit is smaller than EntryByteThreshold, the latter has no effect. The default is zero, meaning there is no limit. |
| BufferedByteLimit | `int` | Maximum number of bytes that the Logger will keep in memory before returning ErrOverflow. This option limits the total memory consumption of the Logger (but note that each Logger has its own, separate limit). It is possible to reach BufferedByteLimit even if it is larger than EntryByteThreshold or EntryByteLimit, because calls triggered by the latter two options may be enqueued (and hence occupying memory) while new log entries are being added. |
| ContextFunc | `func() (ctx context.Context, afterCall func())` | Callback function to be called to obtain `context.Context` during async log ingestion. |
-| SourceLocationPopulation | One of `logging.DoNotPopulateSourceLocation`, `logging.PopulateSourceLocationForDebugEntries` or `logging.AlwaysPopulateSourceLocation` | Controls auto-population of the logging.Entry.SoourceLocation field when ingesting log entries. Allows to disable population of source location info, allowing it only for log entries at Debug severity or enable it for all log entries. Enabling it for all entries may result in degradation in performance. Use `logging_test.BenchmarkSourceLocationPopulation` to test performance with and without the option. The default is set to `logging.DoNotPopulateSourceLocation`. |
+| SourceLocationPopulation | One of `logging.DoNotPopulateSourceLocation`, `logging.PopulateSourceLocationForDebugEntries` or `logging.AlwaysPopulateSourceLocation` | Controls auto-population of the logging.Entry.SourceLocation field when ingesting log entries. Allows to disable population of source location info, allowing it only for log entries at Debug severity or enable it for all log entries. Enabling it for all entries may result in degradation in performance. Use `logging_test.BenchmarkSourceLocationPopulation` to test performance with and without the option. The default is set to `logging.DoNotPopulateSourceLocation`. |
| PartialSuccess | | Make each write call to Logging service with [partialSuccess flag](https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write#body.request_body.FIELDS.partial_success) set. The default is to make calls without setting the flag. |
| RedirectAsJSON | `io.Writer` | Converts log entries to Jsonified one line string according to the [structured logging format](https://cloud.google.com/logging/docs/structured-logging#special-payload-fields) and writes it to provided `io.Writer`. Users should use this option with `os.Stdout` and `os.Stderr` to leverage the out-of-process ingestion of logs using logging agents that are deployed in Cloud Logging environments. |
diff --git a/vendor/cloud.google.com/go/logging/apiv2/config_client.go b/vendor/cloud.google.com/go/logging/apiv2/config_client.go
index 14161ebda..64072dabf 100644
--- a/vendor/cloud.google.com/go/logging/apiv2/config_client.go
+++ b/vendor/cloud.google.com/go/logging/apiv2/config_client.go
@@ -1,4 +1,4 @@
-// Copyright 2022 Google LLC
+// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import (
"net/url"
"time"
+ loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
"cloud.google.com/go/longrunning"
lroauto "cloud.google.com/go/longrunning/autogen"
gax "github.com/googleapis/gax-go/v2"
@@ -30,7 +31,6 @@ import (
"google.golang.org/api/option"
"google.golang.org/api/option/internaloption"
gtransport "google.golang.org/api/transport/grpc"
- loggingpb "google.golang.org/genproto/googleapis/logging/v2"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
diff --git a/vendor/cloud.google.com/go/logging/apiv2/doc.go b/vendor/cloud.google.com/go/logging/apiv2/doc.go
index f748605c4..033fe01b0 100644
--- a/vendor/cloud.google.com/go/logging/apiv2/doc.go
+++ b/vendor/cloud.google.com/go/logging/apiv2/doc.go
@@ -1,4 +1,4 @@
-// Copyright 2022 Google LLC
+// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -19,6 +19,11 @@
//
// Writes log entries and manages your Cloud Logging configuration.
//
+// # General documentation
+//
+// For information about setting deadlines, reusing contexts, and more
+// please visit https://pkg.go.dev/cloud.google.com/go.
+//
// # Example usage
//
// To get started with this package, create a client.
@@ -57,7 +62,7 @@
//
// req := &loggingpb.DeleteLogRequest{
// // TODO: Fill request struct fields.
-// // See https://pkg.go.dev/google.golang.org/genproto/googleapis/logging/v2#DeleteLogRequest.
+// // See https://pkg.go.dev/cloud.google.com/go/logging/apiv2/loggingpb#DeleteLogRequest.
// }
// err = c.DeleteLog(ctx, req)
// if err != nil {
@@ -71,9 +76,6 @@
// Individual methods on the client use the ctx given to them.
//
// To close the open connection, use the Close() method.
-//
-// For information about setting deadlines, reusing contexts, and more
-// please visit https://pkg.go.dev/cloud.google.com/go.
package logging // import "cloud.google.com/go/logging/apiv2"
import (
diff --git a/vendor/cloud.google.com/go/logging/apiv2/logging_client.go b/vendor/cloud.google.com/go/logging/apiv2/logging_client.go
index fe67949ea..d05aa0b95 100644
--- a/vendor/cloud.google.com/go/logging/apiv2/logging_client.go
+++ b/vendor/cloud.google.com/go/logging/apiv2/logging_client.go
@@ -1,4 +1,4 @@
-// Copyright 2022 Google LLC
+// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -23,13 +23,13 @@ import (
"net/url"
"time"
+ loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
"google.golang.org/api/option/internaloption"
gtransport "google.golang.org/api/transport/grpc"
monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres"
- loggingpb "google.golang.org/genproto/googleapis/logging/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
diff --git a/vendor/cloud.google.com/go/logging/apiv2/metrics_client.go b/vendor/cloud.google.com/go/logging/apiv2/metrics_client.go
index ae5b6d426..79fcde1f9 100644
--- a/vendor/cloud.google.com/go/logging/apiv2/metrics_client.go
+++ b/vendor/cloud.google.com/go/logging/apiv2/metrics_client.go
@@ -1,4 +1,4 @@
-// Copyright 2022 Google LLC
+// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -23,12 +23,12 @@ import (
"net/url"
"time"
+ loggingpb "cloud.google.com/go/logging/apiv2/loggingpb"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
"google.golang.org/api/option/internaloption"
gtransport "google.golang.org/api/transport/grpc"
- loggingpb "google.golang.org/genproto/googleapis/logging/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
diff --git a/vendor/cloud.google.com/go/logging/apiv2/version.go b/vendor/cloud.google.com/go/logging/apiv2/version.go
index 2de6c5463..da2bceec5 100644
--- a/vendor/cloud.google.com/go/logging/apiv2/version.go
+++ b/vendor/cloud.google.com/go/logging/apiv2/version.go
@@ -1,4 +1,4 @@
-// Copyright 2022 Google LLC
+// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
diff --git a/vendor/cloud.google.com/go/logging/instrumentation.go b/vendor/cloud.google.com/go/logging/instrumentation.go
index a377d5ccc..b8822e6d1 100644
--- a/vendor/cloud.google.com/go/logging/instrumentation.go
+++ b/vendor/cloud.google.com/go/logging/instrumentation.go
@@ -17,8 +17,8 @@ package logging
import (
"strings"
+ logpb "cloud.google.com/go/logging/apiv2/loggingpb"
"cloud.google.com/go/logging/internal"
- logpb "google.golang.org/genproto/googleapis/logging/v2"
)
const diagnosticLogID = "diagnostic-log"
diff --git a/vendor/cloud.google.com/go/logging/internal/version.go b/vendor/cloud.google.com/go/logging/internal/version.go
index b819fa786..7c251d994 100644
--- a/vendor/cloud.google.com/go/logging/internal/version.go
+++ b/vendor/cloud.google.com/go/logging/internal/version.go
@@ -15,4 +15,4 @@
package internal
// Version is the current tagged release of the library.
-const Version = "1.6.1"
+const Version = "1.7.0"
diff --git a/vendor/cloud.google.com/go/logging/logadmin/logadmin.go b/vendor/cloud.google.com/go/logging/logadmin/logadmin.go
index 8753d8418..1ec2b4c22 100644
--- a/vendor/cloud.google.com/go/logging/logadmin/logadmin.go
+++ b/vendor/cloud.google.com/go/logging/logadmin/logadmin.go
@@ -35,6 +35,7 @@ import (
"cloud.google.com/go/logging"
vkit "cloud.google.com/go/logging/apiv2"
+ logpb "cloud.google.com/go/logging/apiv2/loggingpb"
"cloud.google.com/go/logging/internal"
"github.com/golang/protobuf/ptypes"
gax "github.com/googleapis/gax-go/v2"
@@ -43,7 +44,6 @@ import (
_ "google.golang.org/genproto/googleapis/appengine/logging/v1" // Import the following so EntryIterator can unmarshal log protos.
_ "google.golang.org/genproto/googleapis/cloud/audit"
logtypepb "google.golang.org/genproto/googleapis/logging/type"
- logpb "google.golang.org/genproto/googleapis/logging/v2"
"google.golang.org/grpc/codes"
)
diff --git a/vendor/cloud.google.com/go/logging/logadmin/metrics.go b/vendor/cloud.google.com/go/logging/logadmin/metrics.go
index c6da68416..3db10d748 100644
--- a/vendor/cloud.google.com/go/logging/logadmin/metrics.go
+++ b/vendor/cloud.google.com/go/logging/logadmin/metrics.go
@@ -19,8 +19,8 @@ import (
"fmt"
vkit "cloud.google.com/go/logging/apiv2"
+ logpb "cloud.google.com/go/logging/apiv2/loggingpb"
"google.golang.org/api/iterator"
- logpb "google.golang.org/genproto/googleapis/logging/v2"
)
// Metric describes a logs-based metric. The value of the metric is the
diff --git a/vendor/cloud.google.com/go/logging/logadmin/resources.go b/vendor/cloud.google.com/go/logging/logadmin/resources.go
index 924dee1ad..7f153d21d 100644
--- a/vendor/cloud.google.com/go/logging/logadmin/resources.go
+++ b/vendor/cloud.google.com/go/logging/logadmin/resources.go
@@ -18,9 +18,9 @@ import (
"context"
vkit "cloud.google.com/go/logging/apiv2"
+ logpb "cloud.google.com/go/logging/apiv2/loggingpb"
"google.golang.org/api/iterator"
mrpb "google.golang.org/genproto/googleapis/api/monitoredres"
- logpb "google.golang.org/genproto/googleapis/logging/v2"
)
// ResourceDescriptors returns a ResourceDescriptorIterator
diff --git a/vendor/cloud.google.com/go/logging/logadmin/sinks.go b/vendor/cloud.google.com/go/logging/logadmin/sinks.go
index c7d7a6bc7..0ce310654 100644
--- a/vendor/cloud.google.com/go/logging/logadmin/sinks.go
+++ b/vendor/cloud.google.com/go/logging/logadmin/sinks.go
@@ -20,8 +20,8 @@ import (
"fmt"
vkit "cloud.google.com/go/logging/apiv2"
+ logpb "cloud.google.com/go/logging/apiv2/loggingpb"
"google.golang.org/api/iterator"
- logpb "google.golang.org/genproto/googleapis/logging/v2"
maskpb "google.golang.org/genproto/protobuf/field_mask"
)
diff --git a/vendor/cloud.google.com/go/logging/logging.go b/vendor/cloud.google.com/go/logging/logging.go
index 7b7176ae1..0763640a1 100644
--- a/vendor/cloud.google.com/go/logging/logging.go
+++ b/vendor/cloud.google.com/go/logging/logging.go
@@ -42,6 +42,7 @@ import (
"unicode/utf8"
vkit "cloud.google.com/go/logging/apiv2"
+ logpb "cloud.google.com/go/logging/apiv2/loggingpb"
"cloud.google.com/go/logging/internal"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"
@@ -50,7 +51,6 @@ import (
"google.golang.org/api/support/bundler"
mrpb "google.golang.org/genproto/googleapis/api/monitoredres"
logtypepb "google.golang.org/genproto/googleapis/logging/type"
- logpb "google.golang.org/genproto/googleapis/logging/v2"
"google.golang.org/protobuf/types/known/anypb"
"google.golang.org/protobuf/types/known/timestamppb"
)
@@ -96,7 +96,8 @@ var (
ErrRedirectProtoPayloadNotSupported = errors.New("printEntryToStdout: cannot find valid payload")
// For testing:
- now = time.Now
+ now = time.Now
+ toLogEntryInternal = toLogEntryInternalImpl
// ErrOverflow signals that the number of buffered entries for a Logger
// exceeds its BufferLimit.
@@ -287,7 +288,8 @@ func (c *Client) Logger(logID string, opts ...LoggerOption) *Logger {
}
l.stdLoggers = map[Severity]*log.Logger{}
for s := range severityName {
- l.stdLoggers[s] = log.New(severityWriter{l, s}, "", 0)
+ e := Entry{Severity: s}
+ l.stdLoggers[s] = log.New(templateEntryWriter{l, &e}, "", 0)
}
c.loggers.Add(1)
@@ -301,16 +303,20 @@ func (c *Client) Logger(logID string, opts ...LoggerOption) *Logger {
return l
}
-type severityWriter struct {
- l *Logger
- s Severity
+type templateEntryWriter struct {
+ l *Logger
+ template *Entry
}
-func (w severityWriter) Write(p []byte) (n int, err error) {
- w.l.Log(Entry{
- Severity: w.s,
- Payload: string(p),
- })
+func (w templateEntryWriter) Write(p []byte) (n int, err error) {
+ e := *w.template
+ e.Payload = string(p)
+ // The second argument to logInternal() is how many frames to skip
+ // from the call stack when determining the source location. In the
+ // current implementation of log.Logger (i.e. Go's logging library)
+ // the Write() method is called 2 calls deep so we need to skip 3
+ // frames to account for the call to logInternal() itself.
+ w.l.logInternal(e, 3)
return len(p), nil
}
@@ -656,7 +662,11 @@ func (l *Logger) LogSync(ctx context.Context, e Entry) error {
// Log buffers the Entry for output to the logging service. It never blocks.
func (l *Logger) Log(e Entry) {
- ent, err := toLogEntryInternal(e, l, l.client.parent, 1)
+ l.logInternal(e, 1)
+}
+
+func (l *Logger) logInternal(e Entry, skipLevels int) {
+ ent, err := toLogEntryInternal(e, l, l.client.parent, skipLevels+1)
if err != nil {
l.client.error(err)
return
@@ -721,6 +731,20 @@ func (l *Logger) writeLogEntries(entries []*logpb.LogEntry) {
// (for example by calling SetFlags or SetPrefix).
func (l *Logger) StandardLogger(s Severity) *log.Logger { return l.stdLoggers[s] }
+// StandardLoggerFromTemplate returns a Go Standard Logging API *log.Logger.
+//
+// The returned logger emits logs using logging.(*Logger).Log() with an entry
+// constructed from the provided template Entry struct.
+//
+// The caller is responsible for ensuring that the template Entry struct
+// does not change during the the lifetime of the returned *log.Logger.
+//
+// Prefer (*Logger).StandardLogger() which is more efficient if the template
+// only sets Severity.
+func (l *Logger) StandardLoggerFromTemplate(template *Entry) *log.Logger {
+ return log.New(templateEntryWriter{l, template}, "", 0)
+}
+
func populateTraceInfo(e *Entry, req *http.Request) bool {
if req == nil {
if e.HTTPRequest != nil && e.HTTPRequest.Request != nil {
@@ -834,7 +858,7 @@ func (l *Logger) ToLogEntry(e Entry, parent string) (*logpb.LogEntry, error) {
return toLogEntryInternal(e, l, parent, 1)
}
-func toLogEntryInternal(e Entry, l *Logger, parent string, skipLevels int) (*logpb.LogEntry, error) {
+func toLogEntryInternalImpl(e Entry, l *Logger, parent string, skipLevels int) (*logpb.LogEntry, error) {
if e.LogName != "" {
return nil, errors.New("logging: Entry.LogName should be not be set when writing")
}