log

package module
v0.0.0-...-06b4ca4 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: Apache-2.0 Imports: 10 Imported by: 7

README

Log package for Golang

Build Status codecov Godoc

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

Variables

This section is empty.

Functions

func AddHook

func AddHook(hook logrus.Hook)

func AddSyslogHook

func AddSyslogHook() error

func Debug

func Debug(args ...interface{})

func Debugf

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

func Debugln

func Debugln(args ...interface{})

func Error

func Error(args ...interface{})

func Errorf

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

func Errorln

func Errorln(args ...interface{})

func Fatal

func Fatal(args ...interface{})

func Fatalf

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

func Fatalln

func Fatalln(args ...interface{})

func Info

func Info(args ...interface{})

func Infof

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

func Infoln

func Infoln(args ...interface{})

func Panic

func Panic(args ...interface{})

func Panicf

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

func Panicln

func Panicln(args ...interface{})

func ParseLevel

func ParseLevel(level string) (logrus.Level, error)

func PopModule

func PopModule()

Pop a module off the stack, restoring the previous module. This should be called from the same function that called PushModule() (for consistency in logging.

func Print

func Print(args ...interface{})

func Printf

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

func Println

func Println(args ...interface{})

func PushModule

func PushModule(module string)

Push a module onto the stack, all future logging calls will be printed with this module among the fields, until another module is pushed on top, or this one is popped off the stack.

func SetFormatter

func SetFormatter(formatter logrus.Formatter)

func SetLevel

func SetLevel(level logrus.Level)

func SetModuleFilter

func SetModuleFilter(modules []string)

func SetOutput

func SetOutput(out io.Writer)

func Warn

func Warn(args ...interface{})

func Warnf

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

func Warning

func Warning(args ...interface{})

func Warningf

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

func Warningln

func Warningln(args ...interface{})

func Warnln

func Warnln(args ...interface{})

Types

type Level

type Level logrus.Level

type Logger

type Logger struct {
	// Inherit everything from logrus.Logger.
	logrus.Logger
	// contains filtered or unexported fields
}
var Log *Logger

A global reference to our logger.

func New

func New() *Logger

func (*Logger) AddSyslogHook

func (l *Logger) AddSyslogHook() error

Add the syslog hook to the logger. This is better than adding it directly, for the reasons described in the loggingHookType comments.

func (*Logger) Debug

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

func (*Logger) Debugf

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

func (*Logger) Debugln

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

func (*Logger) Error

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

func (*Logger) Errorf

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

func (*Logger) Errorln

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

func (*Logger) Fatal

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

func (*Logger) Fatalf

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

func (*Logger) Fatalln

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

func (*Logger) Info

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

func (*Logger) Infof

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

func (*Logger) Infoln

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

func (*Logger) Panic

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

func (*Logger) Panicf

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

func (*Logger) Panicln

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

func (*Logger) PopModule

func (l *Logger) PopModule()

Pop a module off the stack, restoring the previous module. This should be called from the same function that called PushModule() (for consistency in logging.

func (*Logger) Print

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

func (*Logger) Printf

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

func (*Logger) Println

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

func (*Logger) PushModule

func (l *Logger) PushModule(module string)

Push a module onto the stack, all future logging calls will be printed with this module among the fields, until another module is pushed on top, or this one is popped off the stack.

func (*Logger) SetModuleFilter

func (l *Logger) SetModuleFilter(modules []string)

func (*Logger) Warn

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

func (*Logger) Warnf

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

func (*Logger) Warning

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

func (*Logger) Warningf

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

func (*Logger) Warningln

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

func (*Logger) Warnln

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

Jump to

Keyboard shortcuts

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