Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Info, Verbose, Debug, Discard = func() (info, verbose, debug, discard Func) {
info, verbose, debug, discard = nothing, nothing, nothing, nothing
l := log.New(os.Stderr, "", 0)
if !IsTerm() {
l.SetFlags(log.LstdFlags)
}
if IsInfo() {
info = l.Printf
}
if IsVerbose() {
verbose = l.Printf
}
if IsDebug() {
debug = func(f string, a ...any) {
l.Printf("DEBUG: "+f, a...)
}
}
return
}()
Functions ¶
func IsTerm ¶
func IsTerm() bool
IsTerm returns true if we appear to be connected to a tty, indicating that there is likely to be a user present. Usually in that case we should default to quieter logging than we would in an unattended scanario, where greater output volume is more easily tolerated and useful.
Types ¶
Click to show internal directories.
Click to hide internal directories.