ull

package
v0.9.5-rc Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry interface {
	Context() (ctx context.Context)
	AppendField(field Field) (err error)
	GetFields() (fields []Field)
}

type Field

type Field struct {
	Key       string
	Interface interface{}
}

func Any

func Any(key string, value interface{}) Field

type FieldLogger

type FieldLogger interface {
	Debugf(format string, a ...any)
	Infof(format string, a ...any)
	Warnf(format string, a ...any)
	Errorf(format string, a ...any)
	Fatalf(format string, a ...any)
}

type Helper

type Helper interface {
	WithContext(ctx context.Context) (logger FieldLogger)
}

type Hook

type Hook interface {
	Levels() (lvs []Level)
	Fire(e Entry) (err error)
}

type Level

type Level = int8
const (
	DebugLevel Level = iota - 1
	// InfoLevel is the default logging priority.
	InfoLevel
	// WarnLevel logs are more important than Info, but don't need individual
	// human review.
	WarnLevel
	// ErrorLevel logs are high-priority. If an application is running smoothly,
	// it shouldn't generate any error-level logs.
	ErrorLevel
	// DPanicLevel logs are particularly important errors. In development the
	// logger panics after writing the message.
	DPanicLevel
	// PanicLevel logs a message, then panics.
	PanicLevel
	// FatalLevel logs a message, then calls os.Exit(1).
	FatalLevel
)

type LevelHooks

type LevelHooks map[Level][]Hook

func (LevelHooks) Add

func (hooks LevelHooks) Add(hook Hook)

Add hook plugin

func (LevelHooks) Fire

func (hooks LevelHooks) Fire(level Level, entry Entry) (err error)

Fire execute hook plugin, if get error return err else return nil

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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