Documentation
¶
Overview ¶
Package logx provides a standard logger implementation for the gomcp project.
Index ¶
- func PrintLevelDebugInfo(logger *log.Logger)
- func SetLogLevelFromString(logger Logger, levelStr string)
- type DefaultLogger
- func (l *DefaultLogger) Debug(msg string, args ...interface{})
- func (l *DefaultLogger) Error(msg string, args ...interface{})
- func (l *DefaultLogger) Info(msg string, args ...interface{})
- func (l *DefaultLogger) IsLevelEnabled(level protocol.LoggingLevel) bool
- func (l *DefaultLogger) SetLevel(level protocol.LoggingLevel)
- func (l *DefaultLogger) Warn(msg string, args ...interface{})
- type Logger
- type StandardLoggerAdapter
- func (a *StandardLoggerAdapter) Debug(format string, v ...interface{})
- func (a *StandardLoggerAdapter) Error(format string, v ...interface{})
- func (a *StandardLoggerAdapter) Info(format string, v ...interface{})
- func (a *StandardLoggerAdapter) IsLevelEnabled(level protocol.LoggingLevel) bool
- func (a *StandardLoggerAdapter) SetLevel(level protocol.LoggingLevel)
- func (a *StandardLoggerAdapter) Warn(format string, v ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintLevelDebugInfo ¶ added in v1.1.4
PrintLevelDebugInfo logs information about how log level severities work This is a helper for debugging purposes
func SetLogLevelFromString ¶ added in v1.1.3
SetLogLevelFromString sets the logging level from a string representation This is a utility function to help external callers set the log level
Types ¶
type DefaultLogger ¶
type DefaultLogger struct {
// contains filtered or unexported fields
}
DefaultLogger provides a basic logger implementation using the standard log package.
func NewDefaultLogger ¶
func NewDefaultLogger() *DefaultLogger
NewDefaultLogger creates a new logger writing to stderr with standard flags.
func (*DefaultLogger) Debug ¶
func (l *DefaultLogger) Debug(msg string, args ...interface{})
Debug logs a message at DEBUG level
func (*DefaultLogger) Error ¶
func (l *DefaultLogger) Error(msg string, args ...interface{})
Error logs a message at ERROR level
func (*DefaultLogger) Info ¶
func (l *DefaultLogger) Info(msg string, args ...interface{})
Info logs a message at INFO level
func (*DefaultLogger) IsLevelEnabled ¶ added in v1.1.4
func (l *DefaultLogger) IsLevelEnabled(level protocol.LoggingLevel) bool
Implementation of IsLevelEnabled for DefaultLogger
func (*DefaultLogger) SetLevel ¶
func (l *DefaultLogger) SetLevel(level protocol.LoggingLevel)
SetLevel updates the logging level for the DefaultLogger.
func (*DefaultLogger) Warn ¶
func (l *DefaultLogger) Warn(msg string, args ...interface{})
Warn logs a message at WARN level
type Logger ¶
type Logger interface {
Debug(format string, v ...interface{})
Info(format string, v ...interface{})
Warn(format string, v ...interface{})
Error(format string, v ...interface{})
SetLevel(level protocol.LoggingLevel)
IsLevelEnabled(level protocol.LoggingLevel) bool
}
Logger defines the interface for logging.
func NewLogger ¶
NewLogger creates a new logger instance based on the configuration. logType can be a log level string like "debug", "info", "warning", "error" or a custom prefix string for backward compatibility
func NewStandardLoggerAdapter ¶ added in v1.1.1
NewStandardLoggerAdapter creates a Logger that wraps a standard Go log.Logger
type StandardLoggerAdapter ¶ added in v1.1.1
type StandardLoggerAdapter struct {
// contains filtered or unexported fields
}
StandardLoggerAdapter adapts a standard log.Logger to implement the Logger interface
func (*StandardLoggerAdapter) Debug ¶ added in v1.1.1
func (a *StandardLoggerAdapter) Debug(format string, v ...interface{})
Debug logs a debug message
func (*StandardLoggerAdapter) Error ¶ added in v1.1.1
func (a *StandardLoggerAdapter) Error(format string, v ...interface{})
Error logs an error message
func (*StandardLoggerAdapter) Info ¶ added in v1.1.1
func (a *StandardLoggerAdapter) Info(format string, v ...interface{})
Info logs an info message
func (*StandardLoggerAdapter) IsLevelEnabled ¶ added in v1.1.4
func (a *StandardLoggerAdapter) IsLevelEnabled(level protocol.LoggingLevel) bool
Implementation of IsLevelEnabled for StandardLoggerAdapter
func (*StandardLoggerAdapter) SetLevel ¶ added in v1.1.1
func (a *StandardLoggerAdapter) SetLevel(level protocol.LoggingLevel)
SetLevel sets the logging level
func (*StandardLoggerAdapter) Warn ¶ added in v1.1.1
func (a *StandardLoggerAdapter) Warn(format string, v ...interface{})
Warn logs a warning message