Documentation ¶
Overview ¶
Package lfshook is hook for sirupsen/logrus that used for writing the logs to local files.
Index ¶
- type LfsHook
- func (hook *LfsHook) Close() error
- func (hook *LfsHook) Fire(entry *logrus.Entry) error
- func (hook *LfsHook) Levels() []logrus.Level
- func (hook *LfsHook) SetDefaultPath(defaultPath string)
- func (hook *LfsHook) SetDefaultWriter(defaultWriter io.WriteCloser)
- func (hook *LfsHook) SetFormatter(formatter logrus.Formatter)
- type PathMap
- type WriterMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LfsHook ¶
type LfsHook struct {
// contains filtered or unexported fields
}
LfsHook is a hook to handle writing to local log files.
func NewHook ¶
NewHook returns new LFS hook. Output can be a string, io.WriteCloser, WriterMap or PathMap. If using io.WriteCloser or WriterMap, user is responsible for closing the used io.WriteCloser.
func (*LfsHook) Fire ¶
Fire writes the log file to defined path or using the defined writer. User who run this function needs write permissions to the file or directory if the file does not yet exist.
func (*LfsHook) SetDefaultPath ¶
SetDefaultPath sets default path for levels that don't have any defined output path.
func (*LfsHook) SetDefaultWriter ¶
func (hook *LfsHook) SetDefaultWriter(defaultWriter io.WriteCloser)
SetDefaultWriter sets default writer for levels that don't have any defined writer.
func (*LfsHook) SetFormatter ¶
SetFormatter sets the format that will be used by hook. If using text formatter, this method will disable color output to make the log file more readable.