Documentation ¶
Index ¶
- Constants
- Variables
- func AddHook(hook logrus.Hook)
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Debugln(args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Errorln(args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Fatalln(args ...interface{})
- func GetLevel() logrus.Level
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Infoln(args ...interface{})
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Panicln(args ...interface{})
- func ParseLevel(lvl string) (logrus.Level, error)
- func Print(args ...interface{})
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func SetFormatter(formatter logrus.Formatter)
- func SetLevel(level logrus.Level)
- func SetOutput(out io.Writer)
- func SetStringLevel(lvl string, defaultLevel logrus.Level)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Warning(args ...interface{})
- func Warningf(format string, args ...interface{})
- func Warningln(args ...interface{})
- func Warnln(args ...interface{})
- type CallerHook
- type Entry
- func (entry *Entry) Debug(args ...interface{})
- func (entry *Entry) Debugf(format string, args ...interface{})
- func (entry *Entry) Debugln(args ...interface{})
- func (entry *Entry) Error(args ...interface{})
- func (entry *Entry) Errorf(format string, args ...interface{})
- func (entry *Entry) Errorln(args ...interface{})
- func (entry *Entry) Fatal(args ...interface{})
- func (entry *Entry) Fatalf(format string, args ...interface{})
- func (entry *Entry) Fatalln(args ...interface{})
- func (entry *Entry) Info(args ...interface{})
- func (entry *Entry) Infof(format string, args ...interface{})
- func (entry *Entry) Infoln(args ...interface{})
- func (entry *Entry) Panic(args ...interface{})
- func (entry *Entry) Panicf(format string, args ...interface{})
- func (entry *Entry) Panicln(args ...interface{})
- func (entry *Entry) Print(args ...interface{})
- func (entry *Entry) Printf(format string, args ...interface{})
- func (entry *Entry) Println(args ...interface{})
- func (entry *Entry) String() (string, error)
- func (entry *Entry) Warn(args ...interface{})
- func (entry *Entry) Warnf(format string, args ...interface{})
- func (entry *Entry) Warning(args ...interface{})
- func (entry *Entry) Warningf(format string, args ...interface{})
- func (entry *Entry) Warningln(args ...interface{})
- func (entry *Entry) Warnln(args ...interface{})
- func (entry *Entry) WithError(err error) *Entry
- func (entry *Entry) WithField(key string, value interface{}) *Entry
- func (entry *Entry) WithFields(fields Fields) *Entry
- func (entry *Entry) WithTime(t time.Time) *Entry
- type Fields
- type Logger
- type NilFormatter
- type NilWriter
Constants ¶
const ( // PanicLevel level, highest level of severity. Logs and then calls panic with the // message passed to Debug, Info, ... PanicLevel logrus.Level = iota // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the // logging level is set to Panic. FatalLevel // ErrorLevel level. Logs. Used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. ErrorLevel // WarnLevel level. Non-critical entries that deserve eyes. WarnLevel // InfoLevel level. General operational entries about what's going on inside the // application. InfoLevel // DebugLevel level. Usually only enabled when debugging. Very verbose logging. DebugLevel )
Variables ¶
var ( // PkgDebugLogFilter is the log filter // if package name exists and log level is more verbose, the log will be dropped PkgDebugLogFilter = map[string]logrus.Level{ "metric": InfoLevel, "rpc": InfoLevel, } // SimpleLog is the flag of simple log format // "Y" for true, "N" for false. defined in `go build` SimpleLog = "N" )
Functions ¶
func Debug ¶
func Debug(args ...interface{})
Debug logs a message at level Debug on the standard logger.
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf logs a message at level Debug on the standard logger.
func Debugln ¶
func Debugln(args ...interface{})
Debugln logs a message at level Debug on the standard logger.
func Error ¶
func Error(args ...interface{})
Error logs a message at level Error on the standard logger.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf logs a message at level Error on the standard logger.
func Errorln ¶
func Errorln(args ...interface{})
Errorln logs a message at level Error on the standard logger.
func Fatal ¶
func Fatal(args ...interface{})
Fatal logs a message at level Fatal on the standard logger.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf logs a message at level Fatal on the standard logger.
func Fatalln ¶
func Fatalln(args ...interface{})
Fatalln logs a message at level Fatal on the standard logger.
func Info ¶
func Info(args ...interface{})
Info logs a message at level Info on the standard logger.
func Infof ¶
func Infof(format string, args ...interface{})
Infof logs a message at level Info on the standard logger.
func Infoln ¶
func Infoln(args ...interface{})
Infoln logs a message at level Info on the standard logger.
func Panic ¶
func Panic(args ...interface{})
Panic logs a message at level Panic on the standard logger.
func Panicf ¶
func Panicf(format string, args ...interface{})
Panicf logs a message at level Panic on the standard logger.
func Panicln ¶
func Panicln(args ...interface{})
Panicln logs a message at level Panic on the standard logger.
func ParseLevel ¶
ParseLevel parse the level string and returns the logger level.
func Print ¶
func Print(args ...interface{})
Print logs a message at level Info on the standard logger.
func Printf ¶
func Printf(format string, args ...interface{})
Printf logs a message at level Info on the standard logger.
func Println ¶
func Println(args ...interface{})
Println logs a message at level Info on the standard logger.
func SetFormatter ¶
SetFormatter sets the standard logger formatter.
func SetStringLevel ¶
SetStringLevel enforce current log level.
func Warn ¶
func Warn(args ...interface{})
Warn logs a message at level Warn on the standard logger.
func Warnf ¶
func Warnf(format string, args ...interface{})
Warnf logs a message at level Warn on the standard logger.
func Warning ¶
func Warning(args ...interface{})
Warning logs a message at level Warn on the standard logger.
func Warningf ¶
func Warningf(format string, args ...interface{})
Warningf logs a message at level Warn on the standard logger.
Types ¶
type CallerHook ¶
CallerHook defines caller awareness hook for logrus.
func NewCallerHook ¶
func NewCallerHook(stackLevels []logrus.Level) *CallerHook
NewCallerHook creates new CallerHook.
func StandardCallerHook ¶
func StandardCallerHook() *CallerHook
StandardCallerHook is a convenience initializer for LogrusStackHook{} with default args.
func (*CallerHook) Fire ¶
func (hook *CallerHook) Fire(entry *logrus.Entry) error
Fire defines hook event handler.
func (*CallerHook) Levels ¶
func (hook *CallerHook) Levels() []logrus.Level
Levels define hook applicable level.
type Entry ¶
Entry defines alias for logrus entry.
func WithError ¶
WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.
func WithField ¶
WithField creates an entry from the standard logger and adds a field to it. If you want multiple fields, use `WithFields`.
Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.
func WithFields ¶
WithFields creates an entry from the standard logger and adds multiple fields to it. This is simply a helper for `WithField`, invoking it once for each field.
Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.
func (*Entry) Debug ¶
func (entry *Entry) Debug(args ...interface{})
Debug record a new debug level log.
func (*Entry) Debugln ¶
func (entry *Entry) Debugln(args ...interface{})
Debugln record a debug level log.
func (*Entry) Error ¶
func (entry *Entry) Error(args ...interface{})
Error record a new error level log.
func (*Entry) Errorln ¶
func (entry *Entry) Errorln(args ...interface{})
Errorln record a error level log.
func (*Entry) Fatal ¶
func (entry *Entry) Fatal(args ...interface{})
Fatal record a fatal level log.
func (*Entry) Fatalln ¶
func (entry *Entry) Fatalln(args ...interface{})
Fatalln record a fatal level log.
func (*Entry) Info ¶
func (entry *Entry) Info(args ...interface{})
Info record a new info level log.
func (*Entry) Infoln ¶
func (entry *Entry) Infoln(args ...interface{})
Infoln record a info level log.
func (*Entry) Panic ¶
func (entry *Entry) Panic(args ...interface{})
Panic record a panic level log.
func (*Entry) Panicln ¶
func (entry *Entry) Panicln(args ...interface{})
Panicln record a panic level log.
func (*Entry) Print ¶
func (entry *Entry) Print(args ...interface{})
Print record a new non-level log.
func (*Entry) Println ¶
func (entry *Entry) Println(args ...interface{})
Println record a non-level log.
func (*Entry) String ¶
Returns the string representation from the reader and ultimately the formatter.
func (*Entry) Warn ¶
func (entry *Entry) Warn(args ...interface{})
Warn record a new warning level log.
func (*Entry) Warning ¶
func (entry *Entry) Warning(args ...interface{})
Warning record a new warning level log.
func (*Entry) Warningln ¶
func (entry *Entry) Warningln(args ...interface{})
Warningln record a warning level log.
func (*Entry) Warnln ¶
func (entry *Entry) Warnln(args ...interface{})
Warnln record a warning level log.
func (*Entry) WithError ¶
WithError adds an error as single field (using the key defined in ErrorKey) to the Entry.
func (*Entry) WithFields ¶
WithFields add a map of fields to the Entry.