Documentation
¶
Overview ¶
Package logger provides logging functionality for the yap application.
Index ¶
- Variables
- func Debug(msg string, args ...any)
- func Error(msg string, args ...any)
- func Fatal(msg string, args ...any)
- func Info(msg string, args ...any)
- func IsColorDisabled() bool
- func IsVerboseEnabled() bool
- func SetColorDisabled(disabled bool)
- func SetVerbose(verbose bool)
- func SetWriter(w io.Writer)
- func Tips(msg string, args ...any)
- func Warn(msg string, args ...any)
- type CustomHandler
- type MultiPrinterImpl
- type YapLogger
Constants ¶
This section is empty.
Variables ¶
var ( // MultiPrinter is the default multiprinter for concurrent logging. MultiPrinter = &MultiPrinterImpl{Writer: os.Stderr} // Logger is the global YapLogger instance. Logger = &YapLogger{} )
var KeyColorMap = map[string]func(string) string{ "package": color.Green, "distro": color.Green, "release": color.Green, "pkgver": color.Green, "pkgrel": color.Green, "source": color.Green, "total_packages": color.Green, "total_batches": color.Green, "count": color.Green, "batch_number": color.Blue, "batch_size": color.Blue, "packages": color.Blue, "parallel_workers": color.Blue, "progress": color.Blue, "duration": color.Blue, "timestamp": color.Blue, "path": color.HiBlue, "command": color.HiBlue, "dir": color.HiBlue, "args": color.HiBlue, "name": color.Cyan, "success": color.Cyan, "operation": color.Cyan, }
KeyColorMap defines the color for each known key category.
Functions ¶
func IsColorDisabled ¶
func IsColorDisabled() bool
IsColorDisabled checks if color output is disabled.
func IsVerboseEnabled ¶
func IsVerboseEnabled() bool
IsVerboseEnabled returns true if verbose logging is enabled.
func SetColorDisabled ¶
func SetColorDisabled(disabled bool)
SetColorDisabled enables or disables color output.
Types ¶
type CustomHandler ¶
type CustomHandler struct {
// contains filtered or unexported fields
}
CustomHandler implements slog.Handler for yap's custom log format.
func (*CustomHandler) Enabled ¶
Enabled reports whether the handler handles records at the given level.
func (*CustomHandler) Handle ¶
Handle formats and writes a log record.
When all key-value pairs fit on one line within the terminal width they are appended inline. When the line would overflow, each pair is rendered on its own indented line with tree connectors (├ / └).
type MultiPrinterImpl ¶
MultiPrinterImpl provides concurrent-safe output handling. Writer is the destination for all log output; Start is a no-op kept for API compatibility with pkg/shell/exec.go.
type YapLogger ¶
type YapLogger struct{}
YapLogger provides yap-specific logging functionality.