Documentation ¶
Index ¶
Constants ¶
View Source
const (
// AppName holds the name of this application
AppName = "CPMA"
)
Variables ¶
View Source
var ( // ConfigFile - keeps full path to the configuration file ConfigFile string )
Functions ¶
func NewLogFileHook ¶
func NewLogFileHook(config LogFileConfig) (logrus.Hook, error)
NewLogFileHook instantiates hook and implements Hook interface
Types ¶
type ConsoleWriterHook ¶
type ConsoleWriterHook struct { Writer io.Writer LogLevels []logrus.Level Formatter logrus.Formatter }
ConsoleWriterHook is a hook that writes logs of specified LogLevels to specified Writer
func (*ConsoleWriterHook) Fire ¶
func (hook *ConsoleWriterHook) Fire(entry *logrus.Entry) error
Fire will be called when some logging function is called with current hook It will format log entry to string and write it to appropriate writer
func (*ConsoleWriterHook) Levels ¶
func (hook *ConsoleWriterHook) Levels() []logrus.Level
Levels define on which log levels this hook would trigger
type LogFileConfig ¶
type LogFileConfig struct { Filename string MaxSize int Level logrus.Level Formatter logrus.Formatter }
LogFileConfig keeps configuration settings required for lumberjack
type LogFileHook ¶
type LogFileHook struct { Config LogFileConfig // contains filtered or unexported fields }
LogFileHook structure implements logfile hook for logrus
func (*LogFileHook) Fire ¶
func (hook *LogFileHook) Fire(entry *logrus.Entry) (err error)
Fire implements actual write()
func (*LogFileHook) Levels ¶
func (hook *LogFileHook) Levels() []logrus.Level
Levels defines and returns the log levels under which logrus fires the "Fire"
Click to show internal directories.
Click to hide internal directories.