log

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package log is a tiny leveled logger for OpenDeezer. It writes to an io.Writer (a file in normal use) rather than stdout/stderr so it never corrupts the Bubble Tea TUI. Levels are filtered by SetLevel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(format string, args ...any)

Debug / Info / Warn / Error emit at their level.

func Error

func Error(format string, args ...any)

func Info

func Info(format string, args ...any)

func OpenFile

func OpenFile(dir string) (*os.File, error)

OpenFile points logging at <dir>/opendeezer.log (appended, 0600), honoring the OPENDEEZER_LOG env var ("debug"/"info"/...) for the level. Returns the file so the caller can Close it; logging is a no-op (discard) on failure.

func SetLevel

func SetLevel(l Level)

SetLevel sets the minimum level that is emitted.

func SetOutput

func SetOutput(w io.Writer)

SetOutput directs log lines to w.

func Warn

func Warn(format string, args ...any)

Types

type Level

type Level int

Level is a severity threshold.

const (
	LevelDebug Level = iota
	LevelInfo
	LevelWarn
	LevelError
	LevelOff
)

func ParseLevel

func ParseLevel(s string) Level

ParseLevel maps a name (case-insensitive) to a Level; unknown => LevelInfo.

func (Level) String

func (l Level) String() string

Jump to

Keyboard shortcuts

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