Documentation
¶
Index ¶
- Variables
- func AlarmFatal(msg string, exitCode int)
- func AlarmPanic(msg string)
- func Debug(msg string, keyValues ...any)
- func Error(msg string, keyValues ...any)
- func Fatal(msg string, keyValues ...any)
- func Info(msg string, keyValues ...any)
- func Panic(msg string, keyValues ...any)
- func RegisterLevel(l Level, s string) error
- func SetGlobalLogger(logger *Logger)
- func Warn(msg string, keyValues ...any)
- type Formatter
- type Level
- type Logger
- func (l *Logger) Debug(msg string, keyValues ...any)
- func (l *Logger) Error(msg string, keyValues ...any)
- func (l *Logger) Fatal(msg string, keyValues ...any)
- func (l *Logger) Info(msg string, keyValues ...any)
- func (l *Logger) Panic(msg string, keyValues ...any)
- func (l *Logger) Warn(msg string, keyValues ...any)
- type TextFormatter
- func (f *TextFormatter) FormatCaller(callerSkip int) bytes.BufferWriter
- func (f *TextFormatter) FormatLevel(level Level) bytes.BufferWriter
- func (f *TextFormatter) FormatMsg(msg string, keyValues ...any) bytes.BufferWriter
- func (f *TextFormatter) FormatTime(t time.Time) bytes.BufferWriter
- func (f *TextFormatter) MsgSplit() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrLevelAlreadyRegistered = errors.New("level already registered")
Functions ¶
func AlarmFatal ¶
func AlarmPanic ¶
func AlarmPanic(msg string)
func RegisterLevel ¶
func SetGlobalLogger ¶
func SetGlobalLogger(logger *Logger)
SetGlobalLogger sets a global logger.
CallerSkip of global logger should be 4 at least. Make sure that you set the correct caller skip.
Types ¶
type Formatter ¶
type Formatter interface {
FormatLevel(level Level) bytes.BufferWriter
FormatTime(t time.Time) bytes.BufferWriter
FormatCaller(callerSkip int) bytes.BufferWriter
FormatMsg(msg string, keyValues ...any) bytes.BufferWriter
MsgSplit() string
}
type TextFormatter ¶
type TextFormatter struct{}
func (*TextFormatter) FormatCaller ¶
func (f *TextFormatter) FormatCaller(callerSkip int) bytes.BufferWriter
func (*TextFormatter) FormatLevel ¶
func (f *TextFormatter) FormatLevel(level Level) bytes.BufferWriter
func (*TextFormatter) FormatMsg ¶
func (f *TextFormatter) FormatMsg(msg string, keyValues ...any) bytes.BufferWriter
func (*TextFormatter) FormatTime ¶
func (f *TextFormatter) FormatTime(t time.Time) bytes.BufferWriter
func (*TextFormatter) MsgSplit ¶
func (f *TextFormatter) MsgSplit() string
Click to show internal directories.
Click to hide internal directories.