log

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultColor = "\033[00m"
	InfoColor    = "\033[94m"
	ErrorColor   = "\033[91m"
	WarnColor    = "\033[93m"
	DebugColor   = "\033[90m"
)

Log colors

View Source
var (
	// CurrentLevel describe the current log level. Only entries with a level
	// inferior or equal to the current level are printed.
	CurrentLevel = WarnLevel
)

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Level   Level
	Message string
	Tags    map[string]string
}

Entry represents a log entry.

func Debug

func Debug(v ...interface{}) Entry

Debug logs an debug message.

func Debugf

func Debugf(format string, v ...interface{}) Entry

Debugf logs an debug message according to the given format.

func Error

func Error(v ...interface{}) Entry

Error logs an error message.

func Errorf

func Errorf(format string, v ...interface{}) Entry

Errorf logs an error message according to the given format.

func Info

func Info(v ...interface{}) Entry

Info logs an info message.

func Infof

func Infof(format string, v ...interface{}) Entry

Infof logs an info message according to the given format.

func Log

func Log(e Entry) Entry

Log logs the given entry.

func Warn

func Warn(v ...interface{}) Entry

Warn logs an warning message.

func Warnf

func Warnf(format string, v ...interface{}) Entry

Warnf logs an warning message according to the given format.

func (Entry) Panic

func (e Entry) Panic()

Panic call panic with the entry message.

func (Entry) T

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

T appends and logs the tag described by the given key/value.

type Level

type Level int

Level represents a log level.

const (
	InfoLevel Level = iota
	ErrorLevel
	WarnLevel
	DebugLevel
)

Constants that describe log level.

func (Level) String

func (l Level) String() string

Jump to

Keyboard shortcuts

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