Documentation ¶
Index ¶
- Constants
- Variables
- func AddFilteredSubsystem(hl string) struct{}
- func AddHighlightedSubsystem(hl string) struct{}
- func AddLogChan() (ch chan Entry)
- func AddLoggerSubsystem(pathBase string) (subsystem string)
- func Caller(comment string, skip int) string
- func DirectionString(inbound bool) string
- func FileExists(filePath string) bool
- func LoadHighlightedSubsystems() (o []string)
- func LoadSubsystemFilter() (o []string)
- func PickNoun(n int, singular, plural string) string
- func SetLogLevel(l string)
- func SetLogWriteToFile(path, appName string) (e error)
- func SetLogWriter(wr io.Writer)
- func SortSubsystemsList()
- func StoreHighlightedSubsystems(highlights []string) (found bool)
- func StoreSubsystemFilter(filter []string)
- type Entry
- type LevelPrinter
- type LevelSpec
Constants ¶
const ( Off = "off" Fatal = "fatal" Error = "error" Warn = "warn" Info = "info" Check = "check" Debug = "debug" Trace = "trace" )
Variables ¶
var ( App = " pod" AppColorizer = color.White.Sprint // LevelSpecs specifies the id, string name and color-printing function LevelSpecs = []LevelSpec{ {logLevels.Off, "off ", color.Bit24(0, 0, 0, false).Sprintf}, {logLevels.Fatal, "fatal", color.Bit24(128, 0, 0, false).Sprintf}, {logLevels.Error, "error", color.Bit24(255, 0, 0, false).Sprintf}, {logLevels.Check, "check", color.Bit24(255, 255, 0, false).Sprintf}, {logLevels.Warn, "warn ", color.Bit24(0, 255, 0, false).Sprintf}, {logLevels.Info, "info ", color.Bit24(255, 255, 0, false).Sprintf}, {logLevels.Debug, "debug", color.Bit24(0, 128, 255, false).Sprintf}, {logLevels.Trace, "trace", color.Bit24(128, 0, 255, false).Sprintf}, } Levels = []string{ Off, Fatal, Error, Check, Warn, Info, Debug, Trace, } LogChanDisabled = uberatomic.NewBool(true) LogChan chan Entry )
Functions ¶
func AddFilteredSubsystem ¶
func AddFilteredSubsystem(hl string) struct{}
AddFilteredSubsystem adds a new subsystem Name to the highlighted list
func AddHighlightedSubsystem ¶
func AddHighlightedSubsystem(hl string) struct{}
AddHighlightedSubsystem adds a new subsystem Name to the highlighted list
func AddLogChan ¶
func AddLogChan() (ch chan Entry)
AddLogChan adds a channel that log entries are sent to
func AddLoggerSubsystem ¶
AddLoggerSubsystem adds a subsystem to the list of known subsystems and returns the string so it is nice and neat in the package logg.go file
func DirectionString ¶
DirectionString is a helper function that returns a string that represents the direction of a connection (inbound or outbound).
func FileExists ¶
func LoadHighlightedSubsystems ¶
func LoadHighlightedSubsystems() (o []string)
LoadHighlightedSubsystems returns a copy of the map of highlighted subsystems
func LoadSubsystemFilter ¶
func LoadSubsystemFilter() (o []string)
LoadSubsystemFilter returns a copy of the map of filtered subsystems
func SetLogLevel ¶
func SetLogLevel(l string)
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.
func SetLogWriteToFile ¶ added in v0.0.10
func SetLogWriter ¶
SetLogWriter atomically changes the log io.Writer interface
func SortSubsystemsList ¶
func SortSubsystemsList()
SortSubsystemsList sorts the list of subsystems, to keep the data read-only, call this function right at the top of the main, which runs after declarations and main/init. Really this is just here to alert the reader.
func StoreHighlightedSubsystems ¶
StoreHighlightedSubsystems sets the list of subsystems to highlight
func StoreSubsystemFilter ¶
func StoreSubsystemFilter(filter []string)
StoreSubsystemFilter sets the list of subsystems to filter
Types ¶
type LevelPrinter ¶
type LevelPrinter struct { // Ln prints lists of interfaces with spaces in between Ln func(a ...interface{}) // F prints like fmt.Println surrounded by log details F func(format string, a ...interface{}) // S prints a spew.Sdump for an interface slice S func(a ...interface{}) // C accepts a function so that the extra computation can be avoided if it is // not being viewed C func(closure func() string) // Chk is a shortcut for printing if there is an error, or returning true Chk func(e error) bool }
LevelPrinter defines a set of terminal printing primitives that output with extra data, time, log logLevelList, and code location
func GetLogPrinterSet ¶
func GetLogPrinterSet(subsystem string) (Fatal, Error, Warn, Info, Debug, Trace LevelPrinter)
GetLogPrinterSet returns a set of LevelPrinter with their subsystem preloaded