Documentation
¶
Index ¶
- Constants
- func Debug(msg any)
- func Debugf(format string, args ...any)
- func Enabled(level Level) bool
- func Error(msg any)
- func Errorf(format string, args ...any)
- func Info(msg any)
- func Infof(format string, args ...any)
- func SetDefault(l Logger)
- func Trace(msg any)
- func Tracef(format string, args ...any)
- func Warn(msg any)
- func Warnf(format string, args ...any)
- type Level
- type Logger
- type SimpleLogger
- func (l *SimpleLogger) Debug(msg any)
- func (l *SimpleLogger) Debugf(format string, args ...any)
- func (l *SimpleLogger) Enabled(level Level) bool
- func (l *SimpleLogger) Error(msg any)
- func (l *SimpleLogger) Errorf(format string, args ...any)
- func (l *SimpleLogger) Info(msg any)
- func (l *SimpleLogger) Infof(format string, args ...any)
- func (l *SimpleLogger) Trace(msg any)
- func (l *SimpleLogger) Tracef(format string, args ...any)
- func (l *SimpleLogger) Warn(msg any)
- func (l *SimpleLogger) Warnf(format string, args ...any)
Constants ¶
const ( TracePrefix = "TRACE " DebugPrefix = "DEBUG " InfoPrefix = "INFO " WarnPrefix = "WARN " ErrorPrefix = "ERROR " )
SimpleLogger prefixes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Level ¶
type Level int
A Level is the importance or severity of a log event. The higher the level, the more important or severe the event.
type Logger ¶
type Logger interface { // Trace logs at LevelTrace. Trace(msg any) // Tracef logs at LevelTrace. Tracef(format string, args ...any) // Debug logs at LevelDebug. Debug(msg any) // Debugf logs at LevelDebug. Debugf(format string, args ...any) // Info logs at LevelInfo. Info(msg any) // Infof logs at LevelInfo. Infof(format string, args ...any) // Warn logs at LevelWarn. Warn(msg any) // Warnf logs at LevelWarn. Warnf(format string, args ...any) // Error logs at LevelError. Error(msg any) // Errorf logs at LevelError. Errorf(format string, args ...any) // Enabled reports whether the logger handles records at the given level. Enabled(level Level) bool }
A Logger handles log records.
type SimpleLogger ¶
type SimpleLogger struct {
// contains filtered or unexported fields
}
SimpleLogger implements the logger.Logger interface.
func NewSimpleLogger ¶
func NewSimpleLogger(logger *log.Logger, level Level) *SimpleLogger
NewSimpleLogger returns a new SimpleLogger.
func (*SimpleLogger) Debug ¶
func (l *SimpleLogger) Debug(msg any)
Debug logs at LevelDebug. Arguments are handled in the manner of fmt.Println.
func (*SimpleLogger) Debugf ¶
func (l *SimpleLogger) Debugf(format string, args ...any)
Debugf logs at LevelDebug. Arguments are handled in the manner of fmt.Printf.
func (*SimpleLogger) Enabled ¶
func (l *SimpleLogger) Enabled(level Level) bool
Enabled reports whether the logger handles records at the given level.
func (*SimpleLogger) Error ¶
func (l *SimpleLogger) Error(msg any)
Error logs at LevelError. Arguments are handled in the manner of fmt.Println.
func (*SimpleLogger) Errorf ¶
func (l *SimpleLogger) Errorf(format string, args ...any)
Errorf logs at LevelError. Arguments are handled in the manner of fmt.Printf.
func (*SimpleLogger) Info ¶
func (l *SimpleLogger) Info(msg any)
Info logs at LevelInfo. Arguments are handled in the manner of fmt.Println.
func (*SimpleLogger) Infof ¶
func (l *SimpleLogger) Infof(format string, args ...any)
Infof logs at LevelInfo. Arguments are handled in the manner of fmt.Printf.
func (*SimpleLogger) Trace ¶
func (l *SimpleLogger) Trace(msg any)
Trace logs at LevelTrace. Arguments are handled in the manner of fmt.Println.
func (*SimpleLogger) Tracef ¶
func (l *SimpleLogger) Tracef(format string, args ...any)
Tracef logs at LevelTrace. Arguments are handled in the manner of fmt.Printf.
func (*SimpleLogger) Warn ¶
func (l *SimpleLogger) Warn(msg any)
Warn logs at LevelWarn. Arguments are handled in the manner of fmt.Println.
func (*SimpleLogger) Warnf ¶
func (l *SimpleLogger) Warnf(format string, args ...any)
Warnf logs at LevelWarn. Arguments are handled in the manner of fmt.Printf.