status

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2018 License: BSD-3-Clause Imports: 5 Imported by: 2

Documentation

Overview

Package status provides a writer for various types of status and is responsible for making sure all of this output is presented cleanly on Stdout. It also captures output from the standard logger and makes sure its output doesn't interfere with other output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is the primary status manager. It implements io.Writer and can function similar to os.Stdout for this purpose. It also captures the standard logger and outputs that with the regular output.

func NewManager

func NewManager() *Manager

NewManager creates a new manager, capturing the current logger.

func (*Manager) Close

func (m *Manager) Close() error

Close closes the meter. The meter is left in place, and the standard logger is restored.

func (*Manager) Meter

func (m *Manager) Meter(delay time.Duration) *Meter

Meter returns a wrapper meter associated with the given text. The duration is the minimal update frequency of the meter.

func (*Manager) Printf

func (m *Manager) Printf(format string, a ...interface{}) (n int, err error)

Printf convenience.

func (*Manager) Write

func (m *Manager) Write(p []byte) (n int, err error)

Write outputs data through to stdout, without corrupting the meter.

type Meter

type Meter struct {
	// contains filtered or unexported fields
}

Meter is a special writer wrapped around a manager. Writes to the meter should be one or more lines of text. Subsequent writes that did not have another type of write to the underlying Manager will be preceeded by cursor movement and clearning to overwrite the meter with an updated value.

func (*Meter) Close

func (me *Meter) Close() error

Close finishes the progress meter. Its output is flushed, and new printing will occur after the meter.

func (*Meter) Flush

func (me *Meter) Flush() error

Flush the meter.

func (*Meter) Printf

func (me *Meter) Printf(format string, a ...interface{}) (n int, err error)

Printf for convenience.

func (*Meter) Write

func (me *Meter) Write(p []byte) (n int, err error)

Write sets a progress meter. The write should consist of one or more lines of text followed by '\n' (the entire write should end with '\n'. The lines should be short enough to not wrap the user's terminal. If other writes are interleaved, this text will be cleared, and rewritten after that other text is printed.

Jump to

Keyboard shortcuts

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