logger

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: CC0-1.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Category added in v1.19.0

func Category(name string, desc *string, displayMode CategoryDisplayMode)

Category logs a category header with a decorative border. If desc is provided, it will be displayed below the category name with auto-wrapping. The displayMode controls the visual style: "border" (default), "border-compact", or "minimal".

func CloseLogger

func CloseLogger()

CloseLogger closes the log file.

func Debug

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

Debug logs a debug message. Only printed if debug mode is enabled.

func Error

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

Error logs an error message.

func GetDefaultLogFile added in v1.14.0

func GetDefaultLogFile() string

GetDefaultLogFile returns the default log file path.

func GetLogDir added in v1.1.0

func GetLogDir() string

GetLogDir returns the appropriate log directory based on the operating system.

func GetLogFile added in v1.14.0

func GetLogFile() string

GetLogFile returns the current log file path (custom or default).

func H added in v1.18.0

func H(text string) string

H is a shorthand alias for Highlight.

func Highlight added in v1.18.0

func Highlight(text string) string

Highlight marks text to be displayed in white/bold in console output. Use this for installer names, types, and other important identifiers.

func Info

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

Info logs an informational message.

func SetLogFile added in v1.14.0

func SetLogFile(path string)

SetLogFile sets a custom log file path.

func Spew

func Spew(v any)

Spew logs a detailed representation of a value using spew.Dump. This is typically used for debugging complex data structures.

func Warn

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

Warn logs a warning message.

Types

type CategoryDisplayMode added in v1.20.0

type CategoryDisplayMode string

CategoryDisplayMode controls how category headers are rendered.

const (
	// CategoryDisplayBorder renders categories with a full border and spacing.
	CategoryDisplayBorder CategoryDisplayMode = "border"
	// CategoryDisplayBorderCompact renders categories with a border but no spacing.
	CategoryDisplayBorderCompact CategoryDisplayMode = "border-compact"
	// CategoryDisplayMinimal renders categories without a border or spacing.
	CategoryDisplayMinimal CategoryDisplayMode = "minimal"
)

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger provides logging functionality with support for file and console output.

func InitLogger

func InitLogger(debug bool) *Logger

InitLogger initializes the global logger with the specified debug mode. It creates the log directory and file if they don't exist. If the log file exceeds maxLogSize, it will be truncated.

Jump to

Keyboard shortcuts

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