From 5be55739ccf2435e96b52ca64ce1627506927069 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 30 Apr 2020 08:54:05 +0000 Subject: build(deps): bump github.com/uber/jaeger-client-go Bumps [github.com/uber/jaeger-client-go](https://github.com/uber/jaeger-client-go) from 2.22.1+incompatible to 2.23.1+incompatible. - [Release notes](https://github.com/uber/jaeger-client-go/releases) - [Changelog](https://github.com/jaegertracing/jaeger-client-go/blob/master/CHANGELOG.md) - [Commits](https://github.com/uber/jaeger-client-go/compare/v2.22.1...v2.23.1) Signed-off-by: dependabot-preview[bot] Signed-off-by: Daniel J Walsh --- .../github.com/uber/jaeger-client-go/log/logger.go | 55 +++++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'vendor/github.com/uber/jaeger-client-go/log/logger.go') 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{}) { +} -- cgit v1.2.3-54-g00ecf