Documentation ¶
Overview ¶
Provides an io.Writer that filters log messages based on a log level.
Valid log levels are: DEBUG, INFO, WARN, ERROR.
Log messages need to begin with a L! where L is one of D, I, W, or E.
Examples:
log.Println("D! this is a debug log") log.Println("I! this is an info log") log.Println("W! this is a warn log") log.Println("E! this is an error log")
Simply pass a instance of wlog.Writer to log.New or use the helper wlog.New function.
The log level can be changed via the SetLevel or the SetLevelFromName functions.
Index ¶
Constants ¶
View Source
const Delimeter = '!'
Variables ¶
View Source
var ReverseLevels map[Level]byte
Functions ¶
func SetLevelFromName ¶
Set the log level via a string name. To set it directly use 'logLevel'.
Types ¶
type StaticLevelWriter ¶
type StaticLevelWriter struct {
// contains filtered or unexported fields
}
func NewStaticLevelWriter ¶
func NewStaticLevelWriter(w io.Writer, level Level) *StaticLevelWriter
Click to show internal directories.
Click to hide internal directories.