Documentation ¶
Index ¶
- func AddFields(fields Fields)
- func AddHook(hook Hook)
- func ContextWithFields(ctx context.Context, fields Fields) context.Context
- 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 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 Print(args ...interface{})
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func SetFormatter(formatter Formatter)
- func SetLevel(level Level)
- func SetOutput(out io.Writer)
- func SetupLogging(c *cli.Context) error
- 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 Entry
- func AddFieldToCtx(ctx context.Context, key string, value interface{}) (context.Context, *Entry)
- func AddFieldsToCtx(ctx context.Context, newFields Fields) (context.Context, *Entry)
- func FromContext(ctx context.Context) *Entry
- func WithError(err error) *Entry
- func WithField(key string, value interface{}) *Entry
- func WithFields(fields Fields) *Entry
- type Fields
- type Formatter
- type Hook
- type Level
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFields ¶
func AddFields(fields Fields)
AddFields adds some fields globally to the standard entry
func ContextWithFields ¶
ContextWithFields set fields in a new context based on ctx, and returns this context. Any Fields defined in ctx will be overriden.
func Debug ¶
func Debug(args ...interface{})
Debug logs a message at level Debug on the standard entry.
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf logs a message at level Debug on the standard entry.
func Debugln ¶
func Debugln(args ...interface{})
Debugln logs a message at level Debug on the standard entry.
func Error ¶
func Error(args ...interface{})
Error logs a message at level Error on the standard entry.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf logs a message at level Error on the standard entry.
func Errorln ¶
func Errorln(args ...interface{})
Errorln logs a message at level Error on the standard entry.
func Fatal ¶
func Fatal(args ...interface{})
Fatal logs a message at level Fatal on the standard entry.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf logs a message at level Fatal on the standard entry.
func Fatalln ¶
func Fatalln(args ...interface{})
Fatalln logs a message at level Fatal on the standard entry.
func Infof ¶
func Infof(format string, args ...interface{})
Infof logs a message at level Info on the standard entry.
func Infoln ¶
func Infoln(args ...interface{})
Infoln logs a message at level Info on the standard entry.
func Panic ¶
func Panic(args ...interface{})
Panic logs a message at level Panic on the standard entry.
func Panicf ¶
func Panicf(format string, args ...interface{})
Panicf logs a message at level Panic on the standard entry.
func Panicln ¶
func Panicln(args ...interface{})
Panicln logs a message at level Panic on the standard entry.
func Print ¶
func Print(args ...interface{})
Print logs a message at level Info on the standard entry.
func Printf ¶
func Printf(format string, args ...interface{})
Printf logs a message at level Info on the standard entry.
func Println ¶
func Println(args ...interface{})
Println logs a message at level Info on the standard entry.
func SetFormatter ¶
func SetFormatter(formatter Formatter)
SetFormatter sets the standard logger formatter.
func SetupLogging ¶
func Warnf ¶
func Warnf(format string, args ...interface{})
Warnf logs a message at level Warn on the standard entry.
func Warning ¶
func Warning(args ...interface{})
Warning logs a message at level Warn on the standard entry.
func Warningf ¶
func Warningf(format string, args ...interface{})
Warningf logs a message at level Warn on the standard entry.
Types ¶
type Entry ¶
Entry is the final or intermediate Logrus logging entry.
func AddFieldToCtx ¶
AddFieldToCtx adds a new field to fields in the ctx (creates a new one if there is none). It returns the new context and a entry will the current Fields objects.
func AddFieldsToCtx ¶
AddFieldsToCtx adds newFields to fields in the ctx (creates a new one if there is none). It returns the new context and a entry will the current Fields objects.
func FromContext ¶
FromContext will create a new Entry based on the Global entry with any custom fields defined in ctx.
func WithError ¶
WithError creates an entry from the standard entry and adds an error to it, using the value defined in ErrorKey as key.
func WithField ¶
WithField creates an entry from the standard entry 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 entry 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.
type Hook ¶
Hook to be fired when logging on the logging levels returned from `Levels()` on your implementation of the interface.
type Level ¶
Level type
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 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 )
These are the different logging levels. You can set the logging level to log on your instance of logger, obtained with `logrus.New()`.