Documentation
¶
Index ¶
- Constants
- func Debug(format string, args ...any)
- func Error(format string, args ...any)
- func GetLevelColor(level LogLevel) string
- func Info(format string, args ...any)
- func SetGlobalLogger(logger Logger)
- func Warn(format string, args ...any)
- type DefaultLogger
- func (l *DefaultLogger) Debug(format string, args ...any)
- func (l *DefaultLogger) Error(format string, args ...any)
- func (l *DefaultLogger) GetLevel() LogLevel
- func (l *DefaultLogger) Info(format string, args ...any)
- func (l *DefaultLogger) SetLevel(level LogLevel)
- func (l *DefaultLogger) SetOutput(w io.Writer)
- func (l *DefaultLogger) Warn(format string, args ...any)
- type LogLevel
- type Logger
- type NullLogger
- func (n *NullLogger) Debug(format string, args ...any)
- func (n *NullLogger) Error(format string, args ...any)
- func (n *NullLogger) GetLevel() LogLevel
- func (n *NullLogger) Info(format string, args ...any)
- func (n *NullLogger) SetLevel(level LogLevel)
- func (n *NullLogger) SetOutput(w io.Writer)
- func (n *NullLogger) Warn(format string, args ...any)
Constants ¶
View Source
const ( ColorReset = "\033[0m" ColorGray = "\033[90m" ColorGreen = "\033[32m" ColorYellow = "\033[33m" ColorRed = "\033[31m" ColorBlue = "\033[34m" ColorCyan = "\033[36m" )
ANSI color codes for terminal output
Variables ¶
This section is empty.
Functions ¶
func GetLevelColor ¶
GetLevelColor returns the color code for a given log level
Types ¶
type DefaultLogger ¶
type DefaultLogger struct {
// contains filtered or unexported fields
}
DefaultLogger is the default logger implementation
func NewDefaultLogger ¶
func NewDefaultLogger(prefix string) *DefaultLogger
NewDefaultLogger creates a new default logger
func (*DefaultLogger) Debug ¶
func (l *DefaultLogger) Debug(format string, args ...any)
Debug logs a debug message
func (*DefaultLogger) Error ¶
func (l *DefaultLogger) Error(format string, args ...any)
Error logs an error message
func (*DefaultLogger) GetLevel ¶
func (l *DefaultLogger) GetLevel() LogLevel
GetLevel returns the current logging level
func (*DefaultLogger) Info ¶
func (l *DefaultLogger) Info(format string, args ...any)
Info logs an info message
func (*DefaultLogger) SetLevel ¶
func (l *DefaultLogger) SetLevel(level LogLevel)
SetLevel sets the logging level
func (*DefaultLogger) SetOutput ¶
func (l *DefaultLogger) SetOutput(w io.Writer)
SetOutput sets the output writer
func (*DefaultLogger) Warn ¶
func (l *DefaultLogger) Warn(format string, args ...any)
Warn logs a warning message
type LogLevel ¶
type LogLevel int
LogLevel represents logging verbosity
func ParseLogLevel ¶
ParseLogLevel parses a log level string into a LogLevel
type Logger ¶
type Logger interface {
Debug(format string, args ...any)
Info(format string, args ...any)
Warn(format string, args ...any)
Error(format string, args ...any)
// Configuration
SetLevel(level LogLevel)
GetLevel() LogLevel
SetOutput(w io.Writer)
}
Logger interface defines core logging methods
type NullLogger ¶
type NullLogger struct {
// contains filtered or unexported fields
}
NullLogger is a logger that does nothing
func (*NullLogger) Debug ¶
func (n *NullLogger) Debug(format string, args ...any)
func (*NullLogger) Error ¶
func (n *NullLogger) Error(format string, args ...any)
func (*NullLogger) GetLevel ¶
func (n *NullLogger) GetLevel() LogLevel
func (*NullLogger) Info ¶
func (n *NullLogger) Info(format string, args ...any)
func (*NullLogger) SetLevel ¶
func (n *NullLogger) SetLevel(level LogLevel)
func (*NullLogger) SetOutput ¶
func (n *NullLogger) SetOutput(w io.Writer)
func (*NullLogger) Warn ¶
func (n *NullLogger) Warn(format string, args ...any)
Click to show internal directories.
Click to hide internal directories.