logging

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const LevelTrace = slog.Level(-8)

LevelTrace is a custom slog.Level used to distinguish trace logging.

Variables

This section is empty.

Functions

func ContextAttr

func ContextAttr(ctx context.Context, attr ...slog.Attr) context.Context

ContextAttr appends a slog.Attr to the provided context.Context so that it will be included in any slog.Record created with such context.

func GetLogLevel

func GetLogLevel() slog.Level

func Setup

func Setup(conf Config) (io.Closer, error)

Types

type Config

type Config struct {
	LogFile  string `json:"logFile"`
	LogLevel Level  `json:"logLevel"`
}

type Level

type Level struct {
	slog.Level
}

Level is a custom slog.Leveler that adds custom levels support extending slog.Level.

func (*Level) UnmarshalText

func (l *Level) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler. It's case-insensitive.

type Span

type Span interface {
	Finish()
}

Span is an interface for single trace spans.

func StartSpan

func StartSpan(ctx context.Context, name string) (Span, context.Context)

StartSpan begins a new Span with the given name. If an existing Span is present in the context.Context, the new Span name will be joined with the parent Span name.

Jump to

Keyboard shortcuts

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