logger

package module
v0.0.0-...-3c7957b Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 11 Imported by: 1

README

logger


Copyright (c) 2024 Archivage Numérique

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BufPool = buffer.NewPool(256)
)
View Source
var (
	Console = &oConsole{w: os.Stdout}
)

Functions

This section is empty.

Types

type Event

type Event struct {
	TS     time.Time
	Logger Logger
	Err    error
	Level  Level
	Msg    string
	KV     []any
}

func (*Event) Free

func (e *Event) Free()

type Level

type Level int
const (
	LevelTrace   Level = 1
	LevelDebug   Level = 2
	LevelInfo    Level = 3
	LevelNotice  Level = 4
	LevelWarning Level = 5
	LevelError   Level = 6
)

func StringToLevel

func StringToLevel(level string) Level

type Logger

type Logger interface {
	ID() string
	Name() string
	New(id, name string) Logger
	Log(err error, level Level, msg string, kv ...any)
	Trace(msg string, kv ...any)
	Debug(msg string, kv ...any)
	Info(msg string, kv ...any)
	Notice(msg string, kv ...any)
	Warning(err error, msg string, kv ...any)
	Error(err error, msg string, kv ...any)
	NewStdLogger(level Level, prefix string, flag int) *log.Logger
}

func New

func New(id, name string, level Level, output Output) Logger

type Output

type Output interface {
	Log(*Event) error
	Close() error
}

func Syslog

func Syslog(app string, facility int) (Output, error)

Jump to

Keyboard shortcuts

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