pkg: github.com/wercker/pkg/log Index | Files

package log

import "github.com/wercker/pkg/log"

Index

Package Files

context.go helper.go log.go

func AddFieldToCtx Uses

func AddFieldToCtx(ctx context.Context, key string, value interface{}) (context.Context, *Entry)

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 AddFields Uses

func AddFields(fields Fields)

AddFields adds some fields globally to the standard entry

func AddFieldsToCtx Uses

func AddFieldsToCtx(ctx context.Context, newFields Fields) (context.Context, *Entry)

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 AddHook Uses

func AddHook(hook Hook)

AddHook adds a hook to the standard logger hooks.

func ContextWithFields Uses

func ContextWithFields(ctx context.Context, fields Fields) context.Context

ContextWithFields set fields in a new context based on ctx, and returns this context. Any Fields defined in ctx will be overriden.

func Debug Uses

func Debug(args ...interface{})

Debug logs a message at level Debug on the standard entry.

func Debugf Uses

func Debugf(format string, args ...interface{})

Debugf logs a message at level Debug on the standard entry.

func Debugln Uses

func Debugln(args ...interface{})

Debugln logs a message at level Debug on the standard entry.

func Error Uses

func Error(args ...interface{})

Error logs a message at level Error on the standard entry.

func Errorf Uses

func Errorf(format string, args ...interface{})

Errorf logs a message at level Error on the standard entry.

func Errorln Uses

func Errorln(args ...interface{})

Errorln logs a message at level Error on the standard entry.

func Fatal Uses

func Fatal(args ...interface{})

Fatal logs a message at level Fatal on the standard entry.

func Fatalf Uses

func Fatalf(format string, args ...interface{})

Fatalf logs a message at level Fatal on the standard entry.

func Fatalln Uses

func Fatalln(args ...interface{})

Fatalln logs a message at level Fatal on the standard entry.

func Info Uses

func Info(args ...interface{})

Info logs a message at level Info on the standard entry.

func Infof Uses

func Infof(format string, args ...interface{})

Infof logs a message at level Info on the standard entry.

func Infoln Uses

func Infoln(args ...interface{})

Infoln logs a message at level Info on the standard entry.

func Panic Uses

func Panic(args ...interface{})

Panic logs a message at level Panic on the standard entry.

func Panicf Uses

func Panicf(format string, args ...interface{})

Panicf logs a message at level Panic on the standard entry.

func Panicln Uses

func Panicln(args ...interface{})

Panicln logs a message at level Panic on the standard entry.

func Print Uses

func Print(args ...interface{})

Print logs a message at level Info on the standard entry.

func Printf Uses

func Printf(format string, args ...interface{})

Printf logs a message at level Info on the standard entry.

func Println Uses

func Println(args ...interface{})

Println logs a message at level Info on the standard entry.

func SetFormatter Uses

func SetFormatter(formatter Formatter)

SetFormatter sets the standard logger formatter.

func SetLevel Uses

func SetLevel(level Level)

SetLevel sets the standard logger level.

func SetOutput Uses

func SetOutput(out io.Writer)

SetOutput sets the standard logger output.

func SetupLogging Uses

func SetupLogging(c *cli.Context) error

func Warn Uses

func Warn(args ...interface{})

Warn logs a message at level Warn on the standard entry.

func Warnf Uses

func Warnf(format string, args ...interface{})

Warnf logs a message at level Warn on the standard entry.

func Warning Uses

func Warning(args ...interface{})

Warning logs a message at level Warn on the standard entry.

func Warningf Uses

func Warningf(format string, args ...interface{})

Warningf logs a message at level Warn on the standard entry.

func Warningln Uses

func Warningln(args ...interface{})

Warningln logs a message at level Warn on the standard entry.

func Warnln Uses

func Warnln(args ...interface{})

Warnln logs a message at level Warn on the standard entry.

type Entry Uses

type Entry struct {
    *logrus.Entry
}

Entry is the final or intermediate Logrus logging entry.

func FromContext Uses

func FromContext(ctx context.Context) *Entry

FromContext will create a new Entry based on the Global entry with any custom fields defined in ctx.

func WithError Uses

func WithError(err error) *Entry

WithError creates an entry from the standard entry and adds an error to it, using the value defined in ErrorKey as key.

func WithField Uses

func WithField(key string, value interface{}) *Entry

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 Uses

func WithFields(fields Fields) *Entry

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.

func (*Entry) WithField Uses

func (e *Entry) WithField(key string, value interface{}) *Entry

WithField wraps logrus

func (*Entry) WithFields Uses

func (e *Entry) WithFields(fields Fields) *Entry

WithFields wraps logrus

type Fields Uses

type Fields logrus.Fields

Fields type, used to pass to `WithFields`

func FieldsFromContext Uses

func FieldsFromContext(ctx context.Context) (Fields, bool)

FieldsFromContext retrieves the Fields from ctx.

type Formatter Uses

type Formatter logrus.Formatter

Formatter interface is used to implement a custom Formatter

type Hook Uses

type Hook logrus.Hook

Hook to be fired when logging on the logging levels returned from `Levels()` on your implementation of the interface.

type Level Uses

type Level logrus.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()`.

func GetLevel Uses

func GetLevel() Level

GetLevel returns the standard logger level.

Package log imports 7 packages (graph) and is imported by 5 packages. Updated 2018-07-29. Refresh now. Tools for package owners.