logging

package
v0.0.6-dev Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PanicLevel level, highest level of severity. Logs and then calls panic with the
	// message passed to Debug, Info, ...
	PanicLevel = Level(iota)
	// FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the
	// logging level is set to Panic.
	FatalLevel
	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	// Commonly used for hooks to send errors to an error tracking service.
	ErrorLevel
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	InfoLevel
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel
	// TraceLevel level. Designates finer-grained informational events than the Debug.
	TraceLevel
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields

type Fields map[string]interface{}

type Level

type Level uint8

Level type

type Loggable

type Loggable interface {
	Log() Logger
}

type Logger

type Logger interface {
	Print(err error, args ...any)
	Printf(format string, err error, args ...any)

	Trace(err error, args ...any)
	Tracef(format string, err error, args ...any)

	Debug(err error, args ...any)
	Debugf(format string, err error, args ...any)

	Info(err error, args ...any)
	Infof(format string, err error, args ...any)

	Warn(err error, args ...any)
	Warnf(format string, err error, args ...any)

	Error(err error, args ...any)
	Errorf(format string, err error, args ...any)

	Fatal(err error, args ...any)
	Fatalf(format string, err error, args ...any)

	Panic(err error, args ...any)
	Panicf(format string, err error, args ...any)

	WithPrefix(prefix string) Logger
	WithFields(fields Fields) Logger

	SetLevel(level Level)
	GetLevel() Level
}

Logger interface used as base logger throughout the library

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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