log

package
v5.0.0-...-03972fd Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(logger Logger, v interface{})

func DecodeClassName

func DecodeClassName(class Class) string

Types

type Class

type Class uint8
const (
	ClassTrace Class = iota + 1
	ClassInfo
	ClassWarning
	ClassError
)

func EncodeClassName

func EncodeClassName(class string) Class

type Logger

type Logger interface {
	Trace(v interface{})
	Info(v interface{})
	Warning(v interface{})
	Error(v interface{})
	Metrics() Metrics
}

func New

func New(
	trace io.Writer,
	info io.Writer,
	warning io.Writer,
	error io.Writer,
	prefix string,
) Logger

func NewDebug

func NewDebug(prefix string) Logger

Create new debug logger with prefix for each entry.

func NewDiscard

func NewDiscard() Logger

func NewEx

func NewEx(
	trace io.Writer,
	info io.Writer,
	warning io.Writer,
	error io.Writer,
	flag int,
	prefix string,
	labels bool,
) Logger

func NewFile

func NewFile(
	fileName string,
	prefix string,
) Logger

Create new file logger with prefix for each entry.

type Metrics

type Metrics struct {
	Traces   int32 `json:"traces,omitempty"`   // Count of trace messages
	Infos    int32 `json:"infos,omitempty"`    // Count of information messages
	Errors   int32 `json:"errors,omitempty"`   // Count of error messages
	Warnings int32 `json:"warnings,omitempty"` // Count of warning messages
}

Statistics for logger

Jump to

Keyboard shortcuts

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