Documentation ¶
Index ¶
- Constants
- Variables
- func GetLoc(skip no) (output string)
- func GetLogLevel(level string) (i no)
- func GetNLoc(n no) (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 no)
- 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 ( // 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}, } NoTimeStomp atomic.Bool )
View Source
var Level atomic.Int32
View Source
var LevelNames = []string{
"off",
"fatal",
"error",
"warn",
"info",
"debug",
"trace",
}
View Source
var Main = &Logger{}
Functions ¶
func GetLogLevel ¶ added in v1.0.2
func GetLogLevel(level string) (i no)
func JoinStrings ¶
func SetLogLevel ¶
func SetLogLevel(level string)
func SetLoggers ¶
func SetLoggers(level no)
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 Chk ¶
type Chk func(e er) bo
Chk is a shortcut for printing if there is an error, or returning true
type Err ¶
type Err func(format string, a ...interface{}) er
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.