This repository has been archived on 2023-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
dex/pkg/log/logrus.go
2019-02-22 21:27:54 +01:00

41 lines
1.0 KiB
Go

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...)
}