Help us shape the future of Go! Take the 2026 Go Developer Survey

log

package
v0.0.163 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LevelTrace = slog.LevelDebug - 4 // no trace level in slog, use debug-4.
	LevelDebug = slog.LevelDebug
	LevelInfo  = slog.LevelInfo
	LevelWarn  = slog.LevelWarn
	LevelError = slog.LevelError
	LevelFatal = slog.LevelError + 4 // no fatal level in slog, use error+4.
	LevelPanic = slog.LevelError + 8 // no panic level in slog, use error+8.

	Disable = slog.LevelInfo + 255 // A level that disables logging, used for testing or no-op logger.
)

Variables

This section is empty.

Functions

func NewLogHandler

func NewLogHandler(logger log.ContextLogger) slog.Handler

NewLogHandler returns a new slog.Handler that writes log records to the given log.ContextLogger

func SBLevelToString

func SBLevelToString(l log.Level) string

SBLevelToString converts a log.Level to its string representation.

Types

type Factory

type Factory interface {
	log.ObservableFactory
	SlogHandler() slog.Handler
}

func NewFactory

func NewFactory(
	handler slog.Handler,
) Factory

NewFactory wraps a slog.Handler into a Factory implementation and is meant to be used with sing-box.

func NewNopFactory

func NewNopFactory(handler slog.Handler) Factory

type SLogger

type SLogger interface {
	Factory
	log.ContextLogger
}

SLogger is an interface that writes logs to a slog.Handler and is compatible with sing-box

Jump to

Keyboard shortcuts

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