Documentation
¶
Index ¶
- Constants
- Variables
- func Debug(first any, args ...any)
- func Error(first any, args ...any)
- func Fatal(first any, args ...any)
- func Info(first any, args ...any)
- func Initialize(logLevel string) *slog.Logger
- func SetExitHandler(handler ExitHandler)
- func Warn(first any, args ...any)
- type ComponentType
- type CustomTextHandler
- type ExitHandler
Constants ¶
View Source
const ( Reset = "\033[0m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" White = "\033[37m" )
ANSI color codes for terminal output
View Source
const LevelFatal slog.Level = slog.Level(12)
LevelFatal defines a new slog level for fatal errors
Variables ¶
View Source
var (
ExitFunc = os.Exit // ExitFunc represents the exit function (used for testing)
)
Global variables
Functions ¶
func Initialize ¶
Initialize sets up the logger with the specified log level
func SetExitHandler ¶
func SetExitHandler(handler ExitHandler)
SetExitHandler sets the handler for fatal exits
Types ¶
type ComponentType ¶
type ComponentType string
ComponentType represents the type of component for logging identification
const ( APP ComponentType = "[APP]" BLE ComponentType = "[BLE]" SPEED ComponentType = "[SPD]" VIDEO ComponentType = "[VID]" )
Supported component types
type CustomTextHandler ¶
CustomTextHandler represents a custom text handler for log formatting
func NewCustomTextHandler ¶
func NewCustomTextHandler(w io.Writer, opts *slog.HandlerOptions) *CustomTextHandler
NewCustomTextHandler creates a new custom text handler with the specified options
Click to show internal directories.
Click to hide internal directories.