logging

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(log Printer, m string, args ...interface{})

Debug will log with debug level

func Fatal

func Fatal(log Printer, m string, args ...interface{})

Fatal will log with fatal level

func Info

func Info(log Printer, m string, args ...interface{})

Info will log with info level

func Log

func Log(log Printer, lvl Level, m string, args ...interface{})

Log will log whatever, behaves sames as printf

func Warn

func Warn(log Printer, m string, args ...interface{})

Warn will log with want level

Types

type Level

type Level uint32

Level type, taken from logrus

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 `logger.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
	// TraceLevel level. Designates finer-grained informational events than the Debug.
	TraceLevel
)

These are the different logging levels. You can set the logging level to log on your instance of logger, obtained with `logrus.New()`.

func ParseLevel

func ParseLevel(lvl string) (Level, error)

ParseLevel takes a string level and returns the Logrus log level constant.

type Printer

type Printer interface {
	Printf(Level, string, ...interface{})
}

Printer simple interface for logging

func NewLogger

func NewLogger(fn loggingFn) Printer

NewLogger returns new logger

func Void

func Void() Printer

Void returns suppressed logger

Jump to

Keyboard shortcuts

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