log

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2023 License: MPL-2.0 Imports: 4 Imported by: 0

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 IsDebug

func IsDebug() bool

func IsInfo

func IsInfo() bool

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.

func IsVerbose

func IsVerbose() bool

Types

type Func

type Func func(string, ...any)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL