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

29 lines
596 B
Go
Raw Normal View History

2019-11-13 11:19:04 -05:00
package elektronLogging
import (
2019-11-21 14:02:47 -05:00
elekLog "github.com/sirupsen/logrus"
"os"
2019-11-13 11:19:04 -05:00
)
type Logger interface {
SetNext(logType Logger)
2019-11-21 14:02:47 -05:00
Log(logType int, level elekLog.Level, logData elekLog.Fields, message string)
2019-11-13 11:19:04 -05:00
SetLogFile(prefix string)
}
type LoggerImpl struct {
2019-11-20 13:33:46 -05:00
Type int
AllowOnConsole bool
LogFileName *os.File
next Logger
2019-11-13 11:19:04 -05:00
}
func (l *LoggerImpl) SetNext(logType Logger) {
l.next = logType
}
2019-11-21 14:02:47 -05:00
func (l *LoggerImpl) Log(logType int, level elekLog.Level, logData elekLog.Fields, message string) {
2019-11-13 11:19:04 -05:00
if l.next != nil {
l.next.Log(logType, level, logData, message)
}
}