log

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColorfulLogger

type ColorfulLogger struct {
	Red     Logger
	Green   Logger
	Yellow  Logger
	Blue    Logger
	Magenta Logger
	Cyan    Logger
	White   Logger
}

ColorfulLogger is a collection of colored loggers.

func NewColorful

func NewColorful(level Level) *ColorfulLogger

NewColorful creates a new colorful logger.

func (*ColorfulLogger) SetLevel

func (l *ColorfulLogger) SetLevel(level Level)

SetLevel updates the logging level of all loggers.

type Level

type Level int

Level is the logging verbosity level.

const (
	// Trace shows logs in all levels.
	Trace Level = iota
	// Debug shows logs in Debug, Info, Warn, Error, and Fatal levels.
	Debug
	// Info shows logs in Info, Warn, Error, and Fatal levels.
	Info
	// Warn shows logs in Warn, Error, and Fatal levels.
	Warn
	// Error shows logs in Error and Fatal levels.
	Error
	// Fatal shows logs in Fatal level.
	Fatal
	// None does not show any logs.
	None
)

type Logger

type Logger interface {
	GetLevel() Level
	SetLevel(l Level)
	Tracef(format string, v ...interface{})
	Debugf(format string, v ...interface{})
	Infof(format string, v ...interface{})
	Warnf(format string, v ...interface{})
	Errorf(format string, v ...interface{})
	Fatalf(format string, v ...interface{})
}

Logger is the interface for a simple logger.

func New

func New(level Level) Logger

New creates a new logger.

func NewColored

func NewColored(level Level, color *color.Color) Logger

NewColored creates a new colored logger.

Jump to

Keyboard shortcuts

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