Documentation
¶
Index ¶
- type Counter
- type Func
- type NoopPrinter
- func (*NoopPrinter) E(_ string, _ ...interface{})
- func (*NoopPrinter) NewCounter(_ string) *Counter
- func (*NoopPrinter) P(_ string, _ ...interface{})
- func (*NoopPrinter) S(_ string, _ ...interface{})
- func (*NoopPrinter) V(_ string, _ ...interface{})
- func (*NoopPrinter) VV(_ string, _ ...interface{})
- type Printer
- type TestPrinter
- func (p *TestPrinter) E(msg string, args ...interface{})
- func (p *TestPrinter) NewCounter(_ string) *Counter
- func (p *TestPrinter) P(msg string, args ...interface{})
- func (p *TestPrinter) S(msg string, args ...interface{})
- func (p *TestPrinter) V(msg string, args ...interface{})
- func (p *TestPrinter) VV(msg string, args ...interface{})
- type UpdateFunc
- type Updater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct {
Updater
// contains filtered or unexported fields
}
A Counter tracks a running count and controls a goroutine that passes its value periodically to a Func.
The Func is also called when SIGUSR1 (or SIGINFO, on BSD) is received.
func NewCounter ¶
NewCounter starts a new Counter.
type Func ¶
A Func is a callback for a Counter.
The final argument is true if Counter.Done has been called, which means that the current call will be the last.
type NoopPrinter ¶ added in v0.17.0
type NoopPrinter struct{}
NoopPrinter discards all messages
func (*NoopPrinter) E ¶ added in v0.17.0
func (*NoopPrinter) E(_ string, _ ...interface{})
func (*NoopPrinter) NewCounter ¶ added in v0.17.0
func (*NoopPrinter) NewCounter(_ string) *Counter
func (*NoopPrinter) P ¶ added in v0.17.0
func (*NoopPrinter) P(_ string, _ ...interface{})
func (*NoopPrinter) S ¶ added in v0.18.0
func (*NoopPrinter) S(_ string, _ ...interface{})
func (*NoopPrinter) V ¶ added in v0.17.0
func (*NoopPrinter) V(_ string, _ ...interface{})
func (*NoopPrinter) VV ¶ added in v0.17.0
func (*NoopPrinter) VV(_ string, _ ...interface{})
type Printer ¶ added in v0.17.0
type Printer interface {
NewCounter(description string) *Counter
// E prints to stderr
E(msg string, args ...interface{})
// S prints to stdout
S(msg string, args ...interface{})
// P prints to stdout unless quiet was passed
P(msg string, args ...interface{})
// V prints to stdout if verbose is set once
V(msg string, args ...interface{})
// VV prints to stdout if verbose is set twice
VV(msg string, args ...interface{})
}
A Printer can can return a new counter or print messages at different log levels. It must be safe to call its methods from concurrent goroutines.
type TestPrinter ¶ added in v0.17.0
type TestPrinter struct {
// contains filtered or unexported fields
}
TestPrinter prints messages during testing
func NewTestPrinter ¶ added in v0.17.0
func NewTestPrinter(t testing.TB) *TestPrinter
func (*TestPrinter) E ¶ added in v0.17.0
func (p *TestPrinter) E(msg string, args ...interface{})
func (*TestPrinter) NewCounter ¶ added in v0.17.0
func (p *TestPrinter) NewCounter(_ string) *Counter
func (*TestPrinter) P ¶ added in v0.17.0
func (p *TestPrinter) P(msg string, args ...interface{})
func (*TestPrinter) S ¶ added in v0.18.0
func (p *TestPrinter) S(msg string, args ...interface{})
func (*TestPrinter) V ¶ added in v0.17.0
func (p *TestPrinter) V(msg string, args ...interface{})
func (*TestPrinter) VV ¶ added in v0.17.0
func (p *TestPrinter) VV(msg string, args ...interface{})
type UpdateFunc ¶
An UpdateFunc is a callback for a (progress) Updater.
The final argument is true if Updater.Done has been called, which means that the current call will be the last.
type Updater ¶
type Updater struct {
// contains filtered or unexported fields
}
An Updater controls a goroutine that periodically calls an UpdateFunc.
The UpdateFunc is also called when SIGUSR1 (or SIGINFO, on BSD) is received.
func NewUpdater ¶
func NewUpdater(interval time.Duration, report UpdateFunc) *Updater
NewUpdater starts a new Updater.