logger

package
v3.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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