Documentation ¶
Index ¶
- Constants
- Variables
- func BreakTo80(s string) (out string)
- func GetLoc(skip int) (output string)
- func JoinStrings(a ...any) (s string)
- func New(writer io.Writer) (l *Log, c *Check, errorf *Errorf)
- func NoSprint(a ...any) string
- func SetLogLevel(level string)
- func SetLoggers(level int)
- func Timestamper() (s string)
- type C
- type Check
- type Chk
- type Entry
- type Err
- type Errorf
- type F
- type LevelPrinter
- type LevelSpec
- type Ln
- type Log
- type Logger
- type S
Constants ¶
View Source
const ( Off = iota Fatal Error Warn Info Debug Trace )
Variables ¶
View Source
var Level atomic.Int32
View Source
var LevelNames = []string{
"off",
"fatal",
"error",
"warn",
"info",
"debug",
"trace",
}
View Source
var ( // LevelSpecs specifies the id, string name and color-printing function LevelSpecs = []LevelSpec{ {Off, "", NoSprint}, {Fatal, "FTL", color.New(color.BgRed, color.FgHiWhite).Sprint}, {Error, "ERR", color.New(color.FgHiRed).Sprint}, {Warn, "WRN", color.New(color.FgHiYellow).Sprint}, {Info, "INF", color.New(color.FgHiGreen).Sprint}, {Debug, "DBG", color.New(color.FgHiBlue).Sprint}, {Trace, "TRC", color.New(color.FgHiMagenta).Sprint}, } )
View Source
var Main = &Logger{}
Functions ¶
func JoinStrings ¶
func SetLogLevel ¶
func SetLogLevel(level string)
func SetLoggers ¶
func SetLoggers(level int)
Types ¶
type C ¶
type C func(closure func() string)
C accepts a function so that the extra computation can be avoided if it is not being viewed
type Err ¶
Err is a pass-through function that uses fmt.Errorf to construct an error and returns the error after printing it to the log
type F ¶
type F func(format string, a ...interface{})
F prints like fmt.Println surrounded by log details
type LevelPrinter ¶
func GetNullPrinter ¶
func GetNullPrinter() LevelPrinter
func GetPrinter ¶
func GetPrinter(l int32, writer io.Writer) LevelPrinter
type Log ¶
type Log struct {
F, E, W, I, D, T LevelPrinter
}
Log is a set of log printers for the various Level items.
Click to show internal directories.
Click to hide internal directories.