summaryrefslogtreecommitdiff
path: root/vendor/github.com/uber/jaeger-client-go/log
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-08 21:34:06 +0200
committerGitHub <noreply@github.com>2020-05-08 21:34:06 +0200
commit7f8b31f5fb59d8b66a26dcd822863fbc18687905 (patch)
tree02ba6090ce80e17cb29d74feb44e43d5ff16090f /vendor/github.com/uber/jaeger-client-go/log
parentaa74c3f09223107b85b6538a1ffe1e359ff51a65 (diff)
parent5be55739ccf2435e96b52ca64ce1627506927069 (diff)
downloadpodman-7f8b31f5fb59d8b66a26dcd822863fbc18687905.tar.gz
podman-7f8b31f5fb59d8b66a26dcd822863fbc18687905.tar.bz2
podman-7f8b31f5fb59d8b66a26dcd822863fbc18687905.zip
Merge pull request #6049 from containers/dependabot/go_modules/github.com/uber/jaeger-client-go-2.23.1incompatible
build(deps): bump github.com/uber/jaeger-client-go from 2.22.1+incompatible to 2.23.1+incompatible
Diffstat (limited to 'vendor/github.com/uber/jaeger-client-go/log')
-rw-r--r--vendor/github.com/uber/jaeger-client-go/log/logger.go55
1 files changed, 53 insertions, 2 deletions
diff --git a/vendor/github.com/uber/jaeger-client-go/log/logger.go b/vendor/github.com/uber/jaeger-client-go/log/logger.go
index 894bb3dbf..ced6e0ce9 100644
--- a/vendor/github.com/uber/jaeger-client-go/log/logger.go
+++ b/vendor/github.com/uber/jaeger-client-go/log/logger.go
@@ -47,13 +47,19 @@ func (l *stdLogger) Infof(msg string, args ...interface{}) {
log.Printf(msg, args...)
}
+// Debugf logs a message at debug priority
+func (l *stdLogger) Debugf(msg string, args ...interface{}) {
+ log.Printf(fmt.Sprintf("DEBUG: %s", msg), args...)
+}
+
// NullLogger is implementation of the Logger interface that is no-op
var NullLogger = &nullLogger{}
type nullLogger struct{}
-func (l *nullLogger) Error(msg string) {}
-func (l *nullLogger) Infof(msg string, args ...interface{}) {}
+func (l *nullLogger) Error(msg string) {}
+func (l *nullLogger) Infof(msg string, args ...interface{}) {}
+func (l *nullLogger) Debugf(msg string, args ...interface{}) {}
// BytesBufferLogger implements Logger backed by a bytes.Buffer.
type BytesBufferLogger struct {
@@ -75,6 +81,13 @@ func (l *BytesBufferLogger) Infof(msg string, args ...interface{}) {
l.mux.Unlock()
}
+// Debugf implements Logger.
+func (l *BytesBufferLogger) Debugf(msg string, args ...interface{}) {
+ l.mux.Lock()
+ l.buf.WriteString("DEBUG: " + fmt.Sprintf(msg, args...) + "\n")
+ l.mux.Unlock()
+}
+
// String returns string representation of the underlying buffer.
func (l *BytesBufferLogger) String() string {
l.mux.Lock()
@@ -88,3 +101,41 @@ func (l *BytesBufferLogger) Flush() {
defer l.mux.Unlock()
l.buf.Reset()
}
+
+// DebugLogger is an interface which adds a debug logging level
+type DebugLogger interface {
+ Logger
+
+ // Debugf logs a message at debug priority
+ Debugf(msg string, args ...interface{})
+}
+
+// DebugLogAdapter is a log adapter that converts a Logger into a DebugLogger
+// If the provided Logger doesn't satisfy the interface, a logger with debug
+// disabled is returned
+func DebugLogAdapter(logger Logger) DebugLogger {
+ if logger == nil {
+ return nil
+ }
+ if debugLogger, ok := logger.(DebugLogger); ok {
+ return debugLogger
+ }
+ logger.Infof("debug logging disabled")
+ return debugDisabledLogAdapter{logger: logger}
+}
+
+type debugDisabledLogAdapter struct {
+ logger Logger
+}
+
+func (d debugDisabledLogAdapter) Error(msg string) {
+ d.logger.Error(msg)
+}
+
+func (d debugDisabledLogAdapter) Infof(msg string, args ...interface{}) {
+ d.logger.Infof(msg, args...)
+}
+
+// Debugf is a nop
+func (d debugDisabledLogAdapter) Debugf(msg string, args ...interface{}) {
+}