Documentation ¶
Index ¶
- Constants
- func AddHook(hook logrus.Hook)
- func CaptureError(args ...interface{})
- func CaptureErrorWith(logger StdLog, args ...interface{})
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func RotateLog(filename string, maxSize int, maxBackup, maxAge int, compress bool) io.Writer
- func SetFormatter(formatter Formatter)
- func SetLevel(level Level)
- func SetLogrusFormatter(formatter logrus.Formatter)
- func SetOutput(out io.Writer)
- func SetStandard(logger *Logger)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type Entry
- type Fields
- type Formatter
- type Level
- type Logger
- type PlainTextFormatter
- type StdLog
Constants ¶
const ErrorKey = "error"
Variables ¶
This section is empty.
Functions ¶
func SetFormatter ¶
func SetFormatter(formatter Formatter)
SetFormatter sets the standard logger Formatter.
func SetStandard ¶
func SetStandard(logger *Logger)
Types ¶
type Entry ¶
func WithError ¶
export WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.
func WithField ¶
export 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 ¶
export 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) WithFields ¶
Add a map of fields to the Entry.
type Level ¶
const ( // PanicLevel level, highest level of severity. Logs and then calls panic with the // message passed to Debug, Info, ... PanicLevel 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 httprxr. 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 )
func ParseLevel ¶
ParseLevel takes a string level and returns the Logrus log level constant.
type Logger ¶
func StandardLogger ¶
func StandardLogger() *Logger
func (*Logger) WithFields ¶
Adds a struct of fields to the log entry. All it does is call `WithField` for each `Field`.
type PlainTextFormatter ¶
type PlainTextFormatter struct { TimestampFormat string // The fields are sorted by default for a consistent output. For applications // that log extremely frequently and don't use the JSON Formatter this may not // be desired. DisableSorting bool // QuoteEmptyFields will wrap empty fields in quotes if true QuoteEmptyFields bool sync.Once }
PlainTextFormatter formats logs into text
type StdLog ¶
type StdLog interface { Info(args ...interface{}) Infof(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Debug(args ...interface{}) Debugf(format string, args ...interface{}) Panic(args ...interface{}) Panicf(format string, args ...interface{}) }