logrush

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2018 License: MIT Imports: 11 Imported by: 1

README

logrush

a logrus wrapper

Feature

a logrus wrapper with prefix display and caller info

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTimestampFormat = ""
)

Functions

func AddHook

func AddHook(hook logrus.Hook)

AddHook adds a hook to the standard logger hooks.

func Debug

func Debug(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(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(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 GetLevel

func GetLevel() logrus.Level

GetLevel returns the standard logger level.

func Info

func Info(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(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(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 SetFormatter

func SetFormatter(formatter logrus.Formatter)

SetFormatter sets the standard logger formatter.

func SetLevel

func SetLevel(level logrus.Level)

SetLevel sets the standard logger level.

func SetOutput

func SetOutput(out io.Writer)

SetOutput sets the standard logger output.

func Warn

func Warn(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(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 Config

type Config struct {
	Output  string
	Level   string
	Verbose bool

	DisableColors bool
	Prefix        string

	ShowCaller     bool
	CallPathLength int // negative means whole path
	// contains filtered or unexported fields
}

Config type.

func (*Config) OutputWriter

func (c *Config) OutputWriter() io.Writer

OutputWriter returns a io.Writer according to the config.

type Entry

type Entry struct {
	*logrus.Entry
}

Entry proxies the logrus.Entry to remove namespace dependency

func WithError

func WithError(err error) *Entry

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{}) *Entry

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 Fields) *Entry

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) WithError

func (e *Entry) WithError(err error) *Entry

WithError is the proxy of entry.WithError

func (*Entry) WithField

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

WithField is the proxy of entry.WithField

func (*Entry) WithFields

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

WithFields is the proxy of entry.WithFields

type Fields

type Fields logrus.Fields

Fields holds the data should be output in log.

type Logger

type Logger struct {
	*logrus.Logger
	// contains filtered or unexported fields
}

Logger is the wrapper of logrus Logger

func New

func New(c *Config) *Logger

New returns a logger with specified prefix.

func StandardLogger

func StandardLogger() *Logger

func (*Logger) Copy

func (logger *Logger) Copy(prefix ...string) *Logger

Copy copies logger with new prefix if provided.

func (*Logger) Debug

func (logger *Logger) Debug(args ...interface{})

Debug is the proxy of logger.Debug()

func (*Logger) Debugf

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

Debugf is the proxy of logger.Debugf()

func (*Logger) Debugln

func (logger *Logger) Debugln(args ...interface{})

Debugln is the proxy of logger.Debugln()

func (*Logger) Error

func (logger *Logger) Error(args ...interface{})

Error is the proxy of logger.Error()

func (*Logger) Errorf

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

Errorf is the proxy of logger.Errorf()

func (*Logger) Errorln

func (logger *Logger) Errorln(args ...interface{})

Errorln is the proxy of logger.Errorln()

func (*Logger) Fatal

func (logger *Logger) Fatal(args ...interface{})

Fatal is the proxy of logger.Fatal()

func (*Logger) Fatalf

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

Fatalf is the proxy of logger.Fatalf()

func (*Logger) Fatalln

func (logger *Logger) Fatalln(args ...interface{})

Fatalln is the proxy of logger.Fatalln()

func (*Logger) Info

func (logger *Logger) Info(args ...interface{})

Info is the proxy of logger.Info()

func (*Logger) Infof

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

Infof is the proxy of logger.Infof()

func (*Logger) Infoln

func (logger *Logger) Infoln(args ...interface{})

Infoln is the proxy of logger.Infoln()

func (*Logger) Panic

func (logger *Logger) Panic(args ...interface{})

Panic is the proxy of logger.Panic()

func (*Logger) Panicf

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

Panicf is the proxy of logger.Panicf()

func (*Logger) Panicln

func (logger *Logger) Panicln(args ...interface{})

Panicln is the proxy of logger.Panicln()

func (*Logger) Prefix

func (logger *Logger) Prefix() string

Prefix returns prefix

func (*Logger) Print

func (logger *Logger) Print(args ...interface{})

Print is the proxy of logger.Print()

func (*Logger) Printf

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

Printf is the proxy of logger.Printf()

func (*Logger) Println

func (logger *Logger) Println(args ...interface{})

Println is the proxy of logger.Println()

func (Logger) SetCallDepthOffset

func (logger Logger) SetCallDepthOffset(offset int) *Logger

SetCallDepthOffset sets call depth offset if config.ShowCaller is set.

func (*Logger) Warn

func (logger *Logger) Warn(args ...interface{})

Warn is the proxy of logger.Warn()

func (*Logger) Warnf

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

Warnf is the proxy of logger.Warnf()

func (*Logger) Warning

func (logger *Logger) Warning(args ...interface{})

Warning is the proxy of logger.Warning()

func (*Logger) Warningf

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

Warningf is the proxy of logger.Warningf()

func (*Logger) Warningln

func (logger *Logger) Warningln(args ...interface{})

Warningln is the proxy of logger.Warningln()

func (*Logger) Warnln

func (logger *Logger) Warnln(args ...interface{})

Warnln is the proxy of logger.Warnln()

func (*Logger) WithError

func (logger *Logger) WithError(err error) *Entry

WithError adds an error as single field to the log entry. All it does is call `WithError` for the given `error`.

func (*Logger) WithField

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

WithField adds a field to the log entry, note that you it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic. It only creates a log entry. If you want multiple fields, use `WithFields`.

func (*Logger) WithFields

func (logger *Logger) WithFields(fields Fields) *Entry

WithFields adds a struct of fields to the log entry. All it does is call `WithField` for each `Field`.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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