log

package
v0.0.0-...-2794e18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2017 License: LGPL-2.1 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PanicLevel level, highest level of severity. Logs and then calls panic with the
	// message passed to Debug, Info, ...
	PanicLevel = logrus.PanicLevel
	// FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the
	// logging level is set to Panic.
	FatalLevel = logrus.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 = logrus.ErrorLevel
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel = logrus.WarnLevel
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	InfoLevel = logrus.InfoLevel
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel = logrus.DebugLevel
)
View Source
const StackInfoFormat = "%s (%s:%s)"
View Source
const UndefStack = "???"

Variables

View Source
var (
	DEBUG  = Level{"DEBUG", 1}
	FINE   = Level{"FINE", 2}
	INFO   = Level{"INFO", 3}
	WARN   = Level{"WARN", 4}
	SEVERE = Level{"SEVERE", 5}
)

Functions

func Debug

func Debug(msg string, 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(msg string, 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(msg string, 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 Fine

func Fine(msg string, args ...interface{})

func GetLevel

func GetLevel() logrus.Level

func GetStackInfo

func GetStackInfo() (string, string, string)

func Info

func Info(msg string, 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(msg string, 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 Print

func Print(msg string, 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 SetDefaultLogLevel

func SetDefaultLogLevel(level Level)

func SetLevel

func SetLevel(level logrus.Level)

func SetOutput

func SetOutput(out io.Writer)

func Severe

func Severe(msg string, args ...interface{})

func StandardLogger

func StandardLogger() logrus.FieldLogger

func Warn

func Warn(msg string, 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(msg string, 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.

func Warningln

func Warningln(args ...interface{})

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

func Warnln

func Warnln(args ...interface{})

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

Types

type Formatter

type Formatter struct {
	*prefixed.TextFormatter
	ShortNames bool
}

func NewFormatter

func NewFormatter(shortNames bool) *Formatter

func (*Formatter) Format

func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error)

type Level

type Level struct {
	Name  string
	Level int
}

------ OLD INTERNAL LOGGER BACKWARD COMPARABLE FUNCTIONS -------------------------------

type Logger

type Logger interface {
	logrus.FieldLogger
}

func WithError

func WithError(err error) Logger

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

func WithField

func WithField(key string, value interface{}) Logger

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

func WithFields(fields map[string]interface{}) Logger

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.

type StackHook

type StackHook struct{}

StackHook is an hook for logrus logger that adds file, line, function info.

func (*StackHook) Fire

func (sh *StackHook) Fire(entry *logrus.Entry) error

Fire is an callback that will be called by logrus for each log entry.

func (*StackHook) Levels

func (sh *StackHook) Levels() []logrus.Level

Levels returns StackHook working levels.

type WithLocalLogger

type WithLocalLogger interface {
	// Log returns Logger instance
	Log() Logger
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL