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{}) Debugln(args ...interface{}) Debugf(msg string, args ...interface{}) Infof(msg string, args ...interface{}) Info(msg string) Infoln(...interface{}) Warn(msg string) Warnln(...interface{}) Warnf(msg string, args ...interface{}) Error(msg string) Errorf(msg string, args ...interface{}) Fatalf(msg string, args ...interface{}) Print(args ...interface{}) Printf(msg string, args ...interface{}) Println(...interface{}) Trace(args ...interface{}) Tracef(msg string, args ...interface{}) Traceln(...interface{}) Verbose() bool // WithFields should return a logger which is annotated with the given // fields. These fields should be added to every logging call on the // returned logger. WithFields(m map[string]interface{}) Logger WithPrefix(prefix string) Logger Level() Level }
Logger implementation is responsible for providing structured and leveled logging functions. Logger implementation is responsible for providing structured and levled 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.