Skip to content

Commit

Permalink
Add interface to Træfik logger
Browse files Browse the repository at this point in the history
  • Loading branch information
nmengin authored and traefiker committed Sep 14, 2018
1 parent 253060b commit c52f4b0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion log/logger.go
Expand Up @@ -10,8 +10,14 @@ import (
"github.com/sirupsen/logrus"
)

// Logger allows overriding the logrus logger behavior
type Logger interface {
logrus.FieldLogger
WriterLevel(logrus.Level) *io.PipeWriter
}

var (
logger *logrus.Entry
logger Logger
logFilePath string
logFile *os.File
)
Expand Down Expand Up @@ -41,6 +47,11 @@ func SetLevel(level logrus.Level) {
logrus.SetLevel(level)
}

// SetLogger sets the logger.
func SetLogger(l Logger) {
logger = l
}

// GetLevel returns the standard logger level.
func GetLevel() logrus.Level {
return logrus.GetLevel()
Expand Down

0 comments on commit c52f4b0

Please sign in to comment.