YTSFlix_Go/vendor/github.com/asticode/go-astilog/logrus.go
2018-11-04 15:58:15 +01:00

28 lines
526 B
Go

package astilog
import (
"github.com/sirupsen/logrus"
)
// Logrus represents a logrus logger
type Logrus struct {
*logrus.Logger
}
// NewLogrus creates a new logrus logger
func NewLogrus() *Logrus {
return &Logrus{Logger: logrus.New()}
}
// WithField implements the LoggerWithFields interface
func (l *Logrus) WithField(k, v string) {
l.AddHook(newWithFieldHook(k, v))
}
// WithFields implements the LoggerWithFields interface
func (l *Logrus) WithFields(fs Fields) {
for k, v := range fs {
l.WithField(k, v)
}
}