logi

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: MIT, Unlicense, Unlicense Imports: 0 Imported by: 0

Documentation

Overview

Package logi is a logger interface designed to allow easy extension with log printer functions and complete reimplementation as required

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{})
	Fatalf(format string, txt ...interface{})
	Errorf(format string, txt ...interface{})
	Warnf(format string, txt ...interface{})
	Infof(format string, txt ...interface{})
	Debugf(format string, txt ...interface{})
	Tracef(format string, txt ...interface{})
	Errors(txt interface{})
	Warns(txt interface{})
	Infos(txt interface{})
	Debugs(txt interface{})
	Traces(txt interface{})
	Fatalc(fn func() string)
	Errorc(fn func() string)
	Warnc(fn func() string)
	Infoc(fn func() string)
	Debugc(fn func() string)
	Tracec(fn func() string)
	// Check prints at error level if the error was not nil and returns true
	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 Level)
}

Logger is an interface that defines the set of operations relevant to a logger.

type Printer

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

Jump to

Keyboard shortcuts

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