Documentation ¶
Index ¶
- Constants
- Variables
- func GetLoc(skip int) (output string)
- func GetLogLevel() (l int)
- func JoinStrings(a ...any) (s string)
- func New(writer io.Writer) (l *Log, c *Check)
- func SetLogLevel(l int)
- func UnixNanoAsFloat() (s string)
- type C
- type Check
- type Chk
- type Entry
- type Err
- type F
- type LevelPrinter
- type LevelSpec
- type Ln
- type Log
- 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, " ", color.Bit24(0, 0, 0, false).Sprint}, {Fatal, "FTL", color.Bit24(128, 0, 0, false).Sprint}, {Error, "ERR", color.Bit24(255, 0, 0, false).Sprint}, {Warn, "WRN", color.Bit24(0, 255, 0, false).Sprint}, {Info, "INF", color.Bit24(255, 255, 0, false).Sprint}, {Debug, "DBG", color.Bit24(0, 125, 255, false).Sprint}, {Trace, "TRC", color.Bit24(125, 0, 255, false).Sprint}, } )
Functions ¶
func GetLogLevel ¶
func GetLogLevel() (l int)
func JoinStrings ¶
func SetLogLevel ¶
func SetLogLevel(l int)
SetLogLevel sets the log level via a string, which can be truncated down to one character, similar to nmcli's argument processor, as the first letter is unique. This could be used with a linter to make larger command sets.
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 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.