Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUnknownLevel unknown log level ErrUnknownLevel = errors.New("unknown log level") )
Functions ¶
This section is empty.
Types ¶
type Level ¶
type Level string
Level type
const ( // LevelDebug usually only enabled when debugging LevelDebug Level = "debug" // LevelInfo general operational entries about what's going on inside the application LevelInfo Level = "info" // LevelWarn non-critical entries that deserve eyes LevelWarn Level = "warn" // LevelError used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. LevelError Level = "error" // LevelFatal Logs and then calls `logger.Exit(1)` LevelFatal Level = "fatal" // LevelPanic logs and then calls panic LevelPanic Level = "panic" )
func ParseLevel ¶
ParseLevel takes a string level and returns the Level constant
type Logger ¶
type Logger interface { Debug(args ...interface{}) Debugf(format string, args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) Panic(args ...interface{}) Panicf(format string, args ...interface{}) WithFields(fields map[string]interface{}) Logger WithPrefix(prefix string) Logger Level() Level }
Logger implementation is responsible for providing structured and leveled logging functions.
type LogrusFileHook ¶
type LogrusFileHook struct {
// contains filtered or unexported fields
}
LogrusFileHook hook for logrus to write log to file
func NewLogrusFileHook ¶
NewLogrusFileHook returns new file hook object for logrus
func (*LogrusFileHook) Fire ¶
func (hook *LogrusFileHook) Fire(entry *logrus.Entry) error
Fire func used by logrus to write the log into a log file
func (*LogrusFileHook) Levels ¶
func (hook *LogrusFileHook) Levels() []logrus.Level
Levels defines in which log levels the file hooks works
Click to show internal directories.
Click to hide internal directories.