This repository has been archived on 2024-04-10. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
elektron/elektronLogging/loggerChain.go
2019-11-21 14:12:53 -05:00

28 lines
576 B
Go

package elektronLogging
import (
log "github.com/sirupsen/logrus"
"os"
)
type Logger interface {
SetNext(logType Logger)
Log(logType int, level log.Level, logData log.Fields, message string)
SetLogFile(prefix string)
}
type LoggerImpl struct {
Type int
AllowOnConsole bool
LogFileName *os.File
next Logger
}
func (l *LoggerImpl) SetNext(logType Logger) {
l.next = logType
}
func (l *LoggerImpl) Log(logType int, level log.Level, logData log.Fields, message string) {
if l.next != nil {
l.next.Log(logType, level, logData, message)
}
}