Documentation
¶
Overview ¶
Package clog is the one logger every katbyte tool logs through: stderr, since stdout is the tool's real output, with timestamps, at WARN unless the tool's own variable (TCTEST_LOG, KOI_LOG) raises it.
Index ¶
Constants ¶
const DefaultLevel = logrus.WarnLevel
DefaultLevel is where a logger starts: warnings and errors only.
const FallbackLevel = logrus.TraceLevel
FallbackLevel is the level a string that does not parse gets: the most verbose, so a typo shows everything rather than hiding what was wanted.
const TimestampFormat = "2006-01-02 15:04:05"
TimestampFormat is the timestamp layout, for a tool that builds its own formatter to match.
Variables ¶
var Log = New()
Log is the one logger the whole process uses, so setting its level once sets it for everything.
Functions ¶
func NewWithOutput ¶
NewWithOutput is New writing to w, so a test can capture the log.
func SetLevel ¶
func SetLevel(level string)
SetLevel sets Log's level from a string such as "debug", by the same rules as SetLevelFromEnv, so a flag and the variable behave alike.
func SetLevelFromEnv ¶
func SetLevelFromEnv(envVar string)
SetLevelFromEnv sets Log's level from a variable such as "TCTEST_LOG": unset leaves DefaultLevel, a value that does not parse gives FallbackLevel and logs the typo. Call it once, before any logging that matters.
Types ¶
This section is empty.