log

package
v0.0.0-...-775528f Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithNewID

func ContextWithNewID(ctx context.Context) context.Context

func Debug

func Debug(args ...any)

func DebugContext

func DebugContext(ctx context.Context, args ...any)

func Error

func Error(args ...any)

func ErrorContext

func ErrorContext(ctx context.Context, args ...any)

func Fatal

func Fatal(args ...any)

func FatalContext

func FatalContext(ctx context.Context, args ...any)

func FormatLevel

func FormatLevel(level Level) string

func Info

func Info(args ...any)

func InfoContext

func InfoContext(ctx context.Context, args ...any)

func Panic

func Panic(args ...any)

func PanicContext

func PanicContext(ctx context.Context, args ...any)

func SetDefault

func SetDefault(logger Logger)

func Trace

func Trace(args ...any)

func TraceContext

func TraceContext(ctx context.Context, args ...any)

func Warn

func Warn(args ...any)

func WarnContext

func WarnContext(ctx context.Context, args ...any)

Types

type ContextID

type ContextID struct {
	ID        uint32
	CreatedAt time.Time
}

func IDFromContext

func IDFromContext(ctx context.Context) (ContextID, bool)

type DefaultOptions

type DefaultOptions struct {
	Level          Level
	Writer         io.Writer
	BaseTime       time.Time
	PlatformWriter io.Writer
	DisableColor   bool
	Timestamp      bool
}

type Level

type Level = uint8
const (
	LevelPanic Level = iota
	LevelFatal
	LevelError
	LevelWarn
	LevelInfo
	LevelDebug
	LevelTrace
)

func ParseLevel

func ParseLevel(level string) (Level, error)

type Logger

type Logger interface {
	WithPrefix(prefix string) Logger
	WithLevel(level Level) Logger

	Trace(args ...any)
	Debug(args ...any)
	Info(args ...any)
	Warn(args ...any)
	Error(args ...any)
	Fatal(args ...any)
	Panic(args ...any)

	TraceContext(ctx context.Context, args ...any)
	DebugContext(ctx context.Context, args ...any)
	InfoContext(ctx context.Context, args ...any)
	WarnContext(ctx context.Context, args ...any)
	ErrorContext(ctx context.Context, args ...any)
	FatalContext(ctx context.Context, args ...any)
	PanicContext(ctx context.Context, args ...any)
}

func Default

func Default() Logger

func NOP

func NOP() Logger

func NewDefault

func NewDefault(options DefaultOptions) Logger

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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