mirror of https://github.com/dexidp/dex.git
14 changed files with 34 additions and 95 deletions
@ -1,40 +0,0 @@
|
||||
package log |
||||
|
||||
import "github.com/sirupsen/logrus" |
||||
|
||||
// LogrusLogger is an adapter for Logrus implementing the Logger interface.
|
||||
type LogrusLogger struct { |
||||
logger logrus.FieldLogger |
||||
} |
||||
|
||||
// NewLogrusLogger returns a new Logger wrapping Logrus.
|
||||
func NewLogrusLogger(logger logrus.FieldLogger) *LogrusLogger { |
||||
return &LogrusLogger{ |
||||
logger: logger, |
||||
} |
||||
} |
||||
|
||||
// Info logs an Info level event.
|
||||
func (l *LogrusLogger) Info(args ...interface{}) { |
||||
l.logger.Info(args...) |
||||
} |
||||
|
||||
// Warn logs a Warn level event.
|
||||
func (l *LogrusLogger) Warn(args ...interface{}) { |
||||
l.logger.Warn(args...) |
||||
} |
||||
|
||||
// Debugf formats and logs a Debug level event.
|
||||
func (l *LogrusLogger) Debugf(format string, args ...interface{}) { |
||||
l.logger.Debugf(format, args...) |
||||
} |
||||
|
||||
// Infof formats and logs an Info level event.
|
||||
func (l *LogrusLogger) Infof(format string, args ...interface{}) { |
||||
l.logger.Infof(format, args...) |
||||
} |
||||
|
||||
// Errorf formats and logs n Error level event.
|
||||
func (l *LogrusLogger) Errorf(format string, args ...interface{}) { |
||||
l.logger.Errorf(format, args...) |
||||
} |
||||
@ -1,10 +0,0 @@
|
||||
package log |
||||
|
||||
import "testing" |
||||
|
||||
func TestLogrusLoggerImplementsLoggerInterface(t *testing.T) { |
||||
var i interface{} = new(LogrusLogger) |
||||
if _, ok := i.(Logger); !ok { |
||||
t.Errorf("expected %T to implement Logger interface", i) |
||||
} |
||||
} |
||||
Loading…
Reference in new issue