Documentation ¶
Overview ¶
Package log is a logging subsystem that provides code optional location tracing and semi-automated subsystem registration and output control.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // LevelSpecs specifies the id, string name and color-printing function LevelSpecs = map[Level]LevelSpec{ Off: gLS(Off, 0, 0, 0), Fatal: gLS(Fatal, 255, 0, 0), Error: gLS(Error, 255, 128, 0), Check: gLS(Check, 255, 255, 0), Warn: gLS(Warn, 128, 255, 0), Info: gLS(Info, 0, 255, 0), Debug: gLS(Debug, 0, 128, 255), Trace: gLS(Trace, 128, 0, 255), } // LvlStr is a map that provides the uniform width strings that are printed // to identify the Level of a log entry. LvlStr = LevelMap{ Off: "off", Fatal: "ftl", Error: "err", Warn: "wrn", Info: "inf", Check: "chk", Debug: "dbg", Trace: "trc", } // App is the name of the application. Change this at the beginning of // an application main. App atomic.String )
Functions ¶
func GetLevelName ¶
func SetLogLevel ¶
func SetLogLevel(l Level)
func SetTimeStampFormat ¶
func SetTimeStampFormat(format string)
SetTimeStampFormat sets a custom timeStampFormat for the logger
Types ¶
type Level ¶
type Level int32
Level is a code representing a scale of importance and context for log entries.
func GetLevelByString ¶
func GetLogLevel ¶
func GetLogLevel() (l Level)
type LevelPrinter ¶
type LevelPrinter struct { Ln Println // F prints like fmt.Println surrounded by log details F Printf // S uses spew.dump to show the content of a variable S Prints // C accepts a function so that the extra computation can be avoided if // it is not being viewed C Printc // Chk is a shortcut for printing if there is an error, or returning // true Chk Chk }
LevelPrinter defines a set of terminal printing primitives that output with extra data, time, level, and code location
type Logger ¶
type Logger struct {
F, E, W, I, D, T LevelPrinter
}
Logger is a set of log printers for the various Level items.
type Printc ¶
type Printc func(closure func() string)
Printc accepts a function so that the extra computation can be avoided if it is not being viewed
type Printf ¶
type Printf func(format string, a ...interface{})
Printf prints like fmt.Println surrounded by log details
Click to show internal directories.
Click to hide internal directories.