logi

package
v0.0.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LevelCodes = []string{
	"TRC", "DBG", "INF", "WRN", "ERR", "FTL",
}

Functions

This section is empty.

Types

type Level

type Level int
const (
	TRACE Level = iota
	DEBUG
	INFO
	WARN
	ERROR
	FATAL
	BOUNDARY
)

type Logger

type Logger interface {
	// The following are printers that print at or below the given level from the constants above
	Fatal(txt interface{})
	Error(txt interface{})
	Warn(txt interface{})
	Info(txt interface{})
	Debug(txt interface{})
	Trace(txt interface{})
	// Check prints at error level but also returns a boolean if the error was not nil
	Check(err error) bool
	// SetPrinter enables loading a printer function to enable networked, piped, etc outputs
	SetPrinter(fn Printer)
	// SetLevel sets the error level, anything lower will not call the printer function
	SetLevel(level int)
}

Logger is an interface that defines the set of operations relevant to a logger. This interface should be a stdlib interface really because logging is so useful for debugging.

type Printer

type Printer func(lvl Level, txt interface{})

Directories

Path Synopsis
Package log is an implementation of the logi.Logger interface that prints log entries to stdout with level code, compact since startup time.Duration and appends the code location of the call to the logger at the end of the log text.
Package log is an implementation of the logi.Logger interface that prints log entries to stdout with level code, compact since startup time.Duration and appends the code location of the call to the logger at the end of the log text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳