log

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package log provides centralized logging functionality for all duckfile components. It supports hierarchical log levels (Error < Warn < Info < Debug) and consistent formatting across the entire application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

func Debugf(msg string, args ...any)

Debugf logs a debug message if the current level is Debug or higher. Debug messages are prefixed with [debug].

func Errorf

func Errorf(msg string, args ...any)

Errorf logs an error message if the current level is Error or higher. Error messages are prefixed with [error].

func Infof

func Infof(msg string, args ...any)

Infof logs an info message if the current level is Info or higher.

func IsLevelEnabled

func IsLevelEnabled(l Level) bool

IsLevelEnabled returns true if the given level would be logged at the current log level. This can be used to avoid expensive operations when logging is disabled.

func SetLevel

func SetLevel(l Level)

SetLevel sets the logging level globally.

func Warnf

func Warnf(msg string, args ...any)

Warnf logs a warning message if the current level is Warn or higher. Warning messages are prefixed with [warn].

Types

type Level

type Level int

Level controls verbosity: Error (min) < Warn < Info (default) < Debug (max)

const (
	Error Level = iota
	Warn
	Info // Default level as per spec
	Debug
)

func GetLevel

func GetLevel() Level

GetLevel returns the current logging level

func ParseLevel

func ParseLevel(s string) (Level, error)

ParseLevel converts a string to a Level

func (Level) String

func (l Level) String() string

String returns the string representation of the log level

Jump to

Keyboard shortcuts

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