dflog

package
v0.0.0-...-9336d8b Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2016 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package dflog wrap around logrus to supply capturing current line and function

Index

Constants

This section is empty.

Variables

AllLevels is constants exposing all logging levels

Functions

This section is empty.

Types

type Entry

type Entry struct {
	*log.Entry
}

Entry wraps logrus.Entry

func (Entry) WithError

func (e Entry) WithError(err error) Entry

WithError implements logrus Entry method WithError.

func (Entry) WithField

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

WithField implements logrus Entry WithField.

func (Entry) WithFields

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

WithFields implements logrus Entry method WithFields.

type Fields

type Fields map[string]interface{}

Fields is alias for logrus.Fields

type Level

type Level uint8

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 (Level) String

func (level Level) String() string

Convert the Level to a string. E.g. PanicLevel becomes "panic".

type Logger

type Logger struct {
	DebugMode bool
	// contains filtered or unexported fields
}

Logger wraps logrus.Logger

func New

func New() Logger

New creates new Logger.

func (Logger) Debug

func (l Logger) Debug(args ...interface{})

Debug implements logrus Debug.

func (Logger) Debugf

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

Debugf implements logrus Debugf.

func (Logger) Debugln

func (l Logger) Debugln(args ...interface{})

Debugln implements logrus Debugln.

func (Logger) Error

func (l Logger) Error(args ...interface{})

Error implements logrus Error.

func (Logger) Errorf

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

Errorf implements logrus Errorf.

func (Logger) Errorln

func (l Logger) Errorln(args ...interface{})

Errorln implements logrus Errorln.

func (Logger) Fatal

func (l Logger) Fatal(args ...interface{})

Fatal implements logrus Fatal.

func (Logger) Fatalf

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

Fatalf implements logrus Fatalf.

func (Logger) Fatalln

func (l Logger) Fatalln(args ...interface{})

Fatalln implements logrus Fatalln.

func (Logger) Info

func (l Logger) Info(args ...interface{})

Info implements logrus Info.

func (Logger) Infof

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

Infof implements logrus Infof.

func (Logger) Infoln

func (l Logger) Infoln(args ...interface{})

Infoln implements logrus Infoln.

func (Logger) Log

func (l Logger) Log(level Level, msg string, err error, fields Fields)

Log implements logrus Panicln.

func (Logger) Panic

func (l Logger) Panic(args ...interface{})

Panic implements logrus Panic.

func (Logger) Panicf

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

Panicf implements logrus Panicf.

func (Logger) Panicln

func (l Logger) Panicln(args ...interface{})

Panicln implements logrus Panicln.

func (Logger) Print

func (l Logger) Print(args ...interface{})

Print implements logrus Print.

func (Logger) Printf

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

Printf implements logrus Printf.

func (Logger) Println

func (l Logger) Println(args ...interface{})

Println implements logrus Println.

func (Logger) SetFormatter

func (l Logger) SetFormatter(formatter log.Formatter)

SetFormatter sets formatter for logger.

func (Logger) SetLevel

func (l Logger) SetLevel(level log.Level)

SetLevel sets log level for logger.

func (Logger) SetOutput

func (l Logger) SetOutput(out io.Writer)

SetOutput sets output for logger.

func (Logger) Warn

func (l Logger) Warn(args ...interface{})

Warn implements logrus Warn.

func (Logger) Warnf

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

Warnf implements logrus Warnf.

func (Logger) Warning

func (l Logger) Warning(args ...interface{})

Warning implements logrus Warning.

func (Logger) Warningf

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

Warningf implements logrus Warningf.

func (Logger) Warningln

func (l Logger) Warningln(args ...interface{})

Warningln implements logrus Warningln.

func (Logger) Warnln

func (l Logger) Warnln(args ...interface{})

Warnln implements logrus Warnln.

func (Logger) WithError

func (l Logger) WithError(err error) Entry

WithError implements logrus WithError.

func (Logger) WithField

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

WithField implements logrus WithField.

func (Logger) WithFields

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

WithFields implements logrus WithFields.

func (Logger) WithStack

func (l Logger) WithStack(err error) Entry

WithStack implements logrus WithError with stacks.

type M

type M map[string]interface{}

M is sort form for logrus.Fields

Jump to

Keyboard shortcuts

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