diff --git a/go.mod b/go.mod index 36c6ea2d..d302be0f 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Masterminds/semver v1.5.0 github.com/alecthomas/kingpin/v2 v2.4.0 github.com/cloudfoundry/bosh-cli v6.4.1+incompatible - github.com/cloudfoundry/bosh-utils v0.0.424 + github.com/cloudfoundry/bosh-utils v0.0.425 github.com/cppforlife/go-patch v0.2.0 github.com/google/go-github v17.0.0+incompatible github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 71ebdf6a..042f1d5c 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,8 @@ github.com/charlievieth/fs v0.0.3 h1:3lZQXTj4PbE81CVPwALSn+JoyCNXkZgORHN6h2XHGlg github.com/charlievieth/fs v0.0.3/go.mod h1:hD4sRzto1Hw8zCua76tNVKZxaeZZr1RiKftjAJQRLLo= github.com/cloudfoundry/bosh-cli v6.4.1+incompatible h1:n5/+NIF9QxvGINOrjh6DmO+GTen78MoCj5+LU9L8bR4= github.com/cloudfoundry/bosh-cli v6.4.1+incompatible/go.mod h1:rzIB+e1sn7wQL/TJ54bl/FemPKRhXby5BIMS3tLuWFM= -github.com/cloudfoundry/bosh-utils v0.0.424 h1:ap9QL5FURJvhO9JVjlSDwqJ5D2GaFKW8yAXoM6D6yTQ= -github.com/cloudfoundry/bosh-utils v0.0.424/go.mod h1:TJjvzOTmMvYyEvsuvieiLmrWqTP5pSklNHiTFIPIQO0= +github.com/cloudfoundry/bosh-utils v0.0.425 h1:bmiu2E+CQyXytREcogkcJsClV72fq/+C3L5Yjruo5vY= +github.com/cloudfoundry/bosh-utils v0.0.425/go.mod h1:TJjvzOTmMvYyEvsuvieiLmrWqTP5pSklNHiTFIPIQO0= github.com/cloudfoundry/go-socks5 v0.0.0-20180221174514-54f73bdb8a8e h1:FQdRViaoDphGRfgrotl2QGsX1gbloe57dbGBS5CG6KY= github.com/cloudfoundry/go-socks5 v0.0.0-20180221174514-54f73bdb8a8e/go.mod h1:PXmcacyJB/pJjSxEl15IU6rEIKXrhZQRzsr0UTkgNNs= github.com/cloudfoundry/socks5-proxy v0.2.108 h1:YlCS+j0Xgatwq5Kux2idwwzHmRZBheZD2nynEf4Jdr0= diff --git a/vendor/github.com/cloudfoundry/bosh-utils/logger/async.go b/vendor/github.com/cloudfoundry/bosh-utils/logger/async.go index d16a5ec4..ff01ed46 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/logger/async.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/logger/async.go @@ -134,3 +134,7 @@ func (l *asyncLogger) ToggleForcedDebug() { func (l *asyncLogger) UseRFC3339Timestamps() { l.log.UseRFC3339Timestamps() } + +func (l *asyncLogger) UseTags(tags []LogTag) { + l.log.UseTags(tags) +} diff --git a/vendor/github.com/cloudfoundry/bosh-utils/logger/logger.go b/vendor/github.com/cloudfoundry/bosh-utils/logger/logger.go index 06a1d110..eaaed0c5 100644 --- a/vendor/github.com/cloudfoundry/bosh-utils/logger/logger.go +++ b/vendor/github.com/cloudfoundry/bosh-utils/logger/logger.go @@ -52,8 +52,8 @@ func AsString(level LogLevel) string { return "DEBUG" } -//to update cd logger && go run github.com/maxbrunsfeld/counterfeiter -generate -//counterfeiter:generate . Logger +// to update cd logger && go run github.com/maxbrunsfeld/counterfeiter -generate +// counterfeiter:generate . Logger type Logger interface { Debug(tag, msg string, args ...interface{}) DebugWithDetails(tag, msg string, args ...interface{}) @@ -64,6 +64,7 @@ type Logger interface { HandlePanic(tag string) ToggleForcedDebug() UseRFC3339Timestamps() + UseTags(tags []LogTag) Flush() error FlushTimeout(time.Duration) error } @@ -74,6 +75,12 @@ type logger struct { forcedDebug bool loggerMu sync.Mutex timestampFormat string + tags []LogTag +} + +type LogTag struct { + Name string `json:"name"` + LogLevel LogLevel `json:"log_level"` } func New(level LogLevel, out *log.Logger) Logger { @@ -100,11 +107,15 @@ func (l *logger) UseRFC3339Timestamps() { l.timestampFormat = rfc3339TimeFormat } +func (l *logger) UseTags(tags []LogTag) { + l.tags = tags +} + func (l *logger) Flush() error { return nil } func (l *logger) FlushTimeout(_ time.Duration) error { return nil } func (l *logger) Debug(tag, msg string, args ...interface{}) { - if l.level > LevelDebug && !l.forcedDebug { + if l.getLogLevel(tag) > LevelDebug && !l.forcedDebug { return } @@ -120,7 +131,7 @@ func (l *logger) DebugWithDetails(tag, msg string, args ...interface{}) { } func (l *logger) Info(tag, msg string, args ...interface{}) { - if l.level > LevelInfo && !l.forcedDebug { + if l.getLogLevel(tag) > LevelInfo && !l.forcedDebug { return } @@ -129,7 +140,7 @@ func (l *logger) Info(tag, msg string, args ...interface{}) { } func (l *logger) Warn(tag, msg string, args ...interface{}) { - if l.level > LevelWarn && !l.forcedDebug { + if l.getLogLevel(tag) > LevelWarn && !l.forcedDebug { return } @@ -138,7 +149,7 @@ func (l *logger) Warn(tag, msg string, args ...interface{}) { } func (l *logger) Error(tag, msg string, args ...interface{}) { - if l.level > LevelError && !l.forcedDebug { + if l.getLogLevel(tag) > LevelError && !l.forcedDebug { return } @@ -190,3 +201,12 @@ func (l *logger) printf(tag, msg string, args ...interface{}) { l.logger.Output(2, s) l.loggerMu.Unlock() } + +func (l *logger) getLogLevel(tag string) LogLevel { + for _, logTag := range l.tags { + if logTag.Name == tag { + return logTag.LogLevel + } + } + return l.level +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 9b594712..9bb3da4b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -29,7 +29,7 @@ github.com/cloudfoundry/bosh-cli/director github.com/cloudfoundry/bosh-cli/director/template github.com/cloudfoundry/bosh-cli/io github.com/cloudfoundry/bosh-cli/uaa -# github.com/cloudfoundry/bosh-utils v0.0.424 +# github.com/cloudfoundry/bosh-utils v0.0.425 ## explicit; go 1.21 github.com/cloudfoundry/bosh-utils/crypto github.com/cloudfoundry/bosh-utils/errors