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
575 B
Go
Raw Normal View History

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