Documentation
¶
Overview ¶
Package logger provides a unified logging interface for the SDK. It supports multiple log levels and allows users to inject custom loggers.
Index ¶
- func Debug(format string, args ...interface{})
- func Error(format string, args ...interface{})
- func Info(format string, args ...interface{})
- func SetDefault(logger Logger)
- func SetLevel(level Level)
- func Warn(format string, args ...interface{})
- type Level
- type Logger
- type NoOpLogger
- func (l *NoOpLogger) Debug(format string, args ...interface{})
- func (l *NoOpLogger) Error(format string, args ...interface{})
- func (l *NoOpLogger) GetLevel() Level
- func (l *NoOpLogger) Info(format string, args ...interface{})
- func (l *NoOpLogger) SetLevel(level Level)
- func (l *NoOpLogger) Warn(format string, args ...interface{})
- type StandardLogger
- func (l *StandardLogger) Debug(format string, args ...interface{})
- func (l *StandardLogger) Error(format string, args ...interface{})
- func (l *StandardLogger) GetLevel() Level
- func (l *StandardLogger) Info(format string, args ...interface{})
- func (l *StandardLogger) SetLevel(level Level)
- func (l *StandardLogger) Warn(format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(format string, args ...interface{})
Debug logs a debug message using the default logger.
func Error ¶
func Error(format string, args ...interface{})
Error logs an error message using the default logger.
Types ¶
type Logger ¶
type Logger interface {
Debug(format string, args ...interface{})
Info(format string, args ...interface{})
Warn(format string, args ...interface{})
Error(format string, args ...interface{})
SetLevel(level Level)
GetLevel() Level
}
Logger is the interface for logging in the SDK.
type NoOpLogger ¶
type NoOpLogger struct{}
NoOpLogger is a logger that does nothing.
func (*NoOpLogger) Debug ¶
func (l *NoOpLogger) Debug(format string, args ...interface{})
Debug does nothing.
func (*NoOpLogger) Error ¶
func (l *NoOpLogger) Error(format string, args ...interface{})
Error does nothing.
func (*NoOpLogger) Info ¶
func (l *NoOpLogger) Info(format string, args ...interface{})
Info does nothing.
func (*NoOpLogger) Warn ¶
func (l *NoOpLogger) Warn(format string, args ...interface{})
Warn does nothing.
type StandardLogger ¶
type StandardLogger struct {
// contains filtered or unexported fields
}
StandardLogger is the default logger implementation using Go's standard log package.
func NewStandardLogger ¶
func NewStandardLogger(level Level, out io.Writer) *StandardLogger
NewStandardLogger creates a new standard logger with the specified level and output.
func (*StandardLogger) Debug ¶
func (l *StandardLogger) Debug(format string, args ...interface{})
Debug logs a debug message.
func (*StandardLogger) Error ¶
func (l *StandardLogger) Error(format string, args ...interface{})
Error logs an error message.
func (*StandardLogger) GetLevel ¶
func (l *StandardLogger) GetLevel() Level
GetLevel returns the current log level.
func (*StandardLogger) Info ¶
func (l *StandardLogger) Info(format string, args ...interface{})
Info logs an informational message.
func (*StandardLogger) SetLevel ¶
func (l *StandardLogger) SetLevel(level Level)
SetLevel sets the minimum log level.
func (*StandardLogger) Warn ¶
func (l *StandardLogger) Warn(format string, args ...interface{})
Warn logs a warning message.