Documentation
¶
Overview ¶
Package logutils augments the standard log package with levels.
Index ¶
- Variables
- func Debug(v ...any)
- func Debugf(format string, v ...any)
- func Debugln(v ...any)
- func Error(v ...any)
- func Errorf(format string, v ...any)
- func Errorln(v ...any)
- func Fatal(v ...any)
- func Fatalf(format string, v ...any)
- func Fatalln(v ...any)
- func Print(v ...any)
- func Printf(format string, v ...any)
- func Println(v ...any)
- func Warn(v ...any)
- func Warnf(format string, v ...any)
- func Warnln(v ...any)
- type LevelFilter
- type LogLevel
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultLevelFilter = &LevelFilter{ Levels: []LogLevel{"TRACE", "DEBUG", "INFO", "WARN", "ERROR"}, MinLevel: "WARN", Writer: os.Stdout, }
Functions ¶
Types ¶
type LevelFilter ¶
type LevelFilter struct {
// Levels is the list of log levels, in increasing order of
// severity. Example might be: {"DEBUG", "WARN", "ERROR"}.
Levels []LogLevel
// MinLevel is the minimum level allowed through
MinLevel LogLevel
// The underlying io.Writer where log messages that pass the filter
// will be set.
Writer io.Writer
// contains filtered or unexported fields
}
LevelFilter is an io.Writer that can be used with a logger that will filter out log messages that aren't at least a certain level.
Once the filter is in use somewhere, it is not safe to modify the structure.
func (*LevelFilter) Check ¶
func (f *LevelFilter) Check(line []byte) bool
Check will check a given line if it would be included in the level filter.
func (*LevelFilter) SetMinLevel ¶
func (f *LevelFilter) SetMinLevel(min LogLevel)
SetMinLevel is used to update the minimum log level
Click to show internal directories.
Click to hide internal directories.