logger

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	Stdout  io.Writer
	Stderr  io.Writer
	Verbose bool
	Color   bool
}

Logger is just a wrapper that prints stuff to STDOUT or STDERR, with optional color.

func (*Logger) Errf

func (l *Logger) Errf(print PrintFunc, s string, args ...interface{})

Errf prints stuff to STDERR.

func (*Logger) Outf

func (l *Logger) Outf(print PrintFunc, s string, args ...interface{})

Outf prints stuff to STDOUT.

func (*Logger) VerboseErrf

func (l *Logger) VerboseErrf(print PrintFunc, s string, args ...interface{})

VerboseErrf prints stuff to STDERR if verbose mode is enabled.

func (*Logger) VerboseOutf

func (l *Logger) VerboseOutf(print PrintFunc, s string, args ...interface{})

VerboseOutf prints stuff to STDOUT if verbose mode is enabled.

type PrintFunc

type PrintFunc func(io.Writer, string, ...interface{})
var (
	Default PrintFunc = color.New(color.Reset).FprintfFunc()
	Blue    PrintFunc = color.New(color.FgBlue).FprintfFunc()
	Green   PrintFunc = color.New(color.FgGreen).FprintfFunc()
	Cyan    PrintFunc = color.New(color.FgCyan).FprintfFunc()
	Yellow  PrintFunc = color.New(color.FgYellow).FprintfFunc()
	Magenta PrintFunc = color.New(color.FgMagenta).FprintfFunc()
	Red     PrintFunc = color.New(color.FgRed).FprintfFunc()
)

Jump to

Keyboard shortcuts

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