logging

package
v0.73.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LevelTrace is a custom TRACE log level.
	LevelTrace = slog.Level(-8)
	// LevelFatal is a custom FATAL log level.
	LevelFatal = slog.Level(12)
)

Variables

View Source
var (
	DefaultLogFile = "/app/foragd.log"
	Level          slog.Level
)

DefaultLogFile is the default log file location.

View Source
var LevelNames = map[slog.Leveler]string{
	LevelTrace: "TRACE",
	LevelFatal: "FATAL",
}

LevelNames contains a list of custom log level names.

Functions

func New

func New(options Options) *slog.Logger

New creates a new logger with the given options.

func StartProfiling

func StartProfiling(logger *slog.Logger, flags ProfileFlags) error

func StopProfiling

func StopProfiling(logger *slog.Logger, flags ProfileFlags) error

Types

type Options

type Options struct {
	LogLevel  string `env:"FORAGD_LOGLEVEL"  name:"log-level"   enum:"info,debug,trace" default:"info"  help:"Set logging level."`
	NoLogFile bool   `env:"FORAGD_NOLOGFILE" name:"no-log-file"                         default:"false" help:"Don't write to a log file."`
}

Options are options for controlling logging.

type ProfileFlags

type ProfileFlags map[string]string

Jump to

Keyboard shortcuts

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