logger

package
v3.37.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPromptCancelled = errors.New("prompt cancelled")
	ErrNoTerminal      = errors.New("no terminal")
)

Functions

This section is empty.

Types

type Color added in v3.4.3

type Color func() PrintFunc

type Logger

type Logger struct {
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
	Verbose    bool
	Color      bool
	AssumeYes  bool
	AssumeTerm bool // Used for testing
}

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

func (*Logger) Errf

func (l *Logger) Errf(color Color, s string, args ...any)

Errf prints stuff to STDERR.

func (*Logger) FOutf added in v3.17.0

func (l *Logger) FOutf(w io.Writer, color Color, s string, args ...any)

FOutf prints stuff to the given writer.

func (*Logger) Outf

func (l *Logger) Outf(color Color, s string, args ...any)

Outf prints stuff to STDOUT.

func (*Logger) Prompt added in v3.30.0

func (l *Logger) Prompt(color Color, prompt string, defaultValue string, continueValues ...string) error

func (*Logger) VerboseErrf

func (l *Logger) VerboseErrf(color Color, s string, args ...any)

VerboseErrf prints stuff to STDERR if verbose mode is enabled.

func (*Logger) VerboseOutf

func (l *Logger) VerboseOutf(color Color, s string, args ...any)

VerboseOutf prints stuff to STDOUT if verbose mode is enabled.

func (*Logger) Warnf added in v3.37.0

func (l *Logger) Warnf(message string, args ...any)

type PrintFunc

type PrintFunc func(io.Writer, string, ...any)

func Blue

func Blue() PrintFunc

func Cyan

func Cyan() PrintFunc

func Default

func Default() PrintFunc

func Green

func Green() PrintFunc

func Magenta

func Magenta() PrintFunc

func Red

func Red() PrintFunc

func Yellow

func Yellow() PrintFunc

Jump to

Keyboard shortcuts

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