output

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HumanElapsed

func HumanElapsed(start time.Time) time.Duration

HumanElapsed returns the time elapsed since the given start time truncated to 100x the highest non-zero duration unit (ns, us, ms, ...). This tends to create very short duration strings when printed (e.g. 725.8ms) without having to fiddle too much with

func Logf added in v0.1.5

func Logf(format string, a ...any)

func Printf added in v0.1.4

func Printf(format string, a ...any)

func Println

func Println(a ...any)

func SetOutputOptions

func SetOutputOptions(verb Verbosity, animation bool)

func WithProgress

func WithProgress(name string, fn func() error) error

WithProgress prints a spinner while the given function is active.

func WithProgressParallel

func WithProgressParallel(wg *sync.WaitGroup, name string, c *uint64, n uint64)

WithProgressParallel will continuously print progress to stdout until the given wait group counter goes to zero. Progress is determined by the values of `c` (number of tasks completed) and the value `n` (total number of tasks).

Types

type Options

type Options struct {
	Verbosity      Verbosity
	ShowAnimations bool
}

type Verbosity

type Verbosity int
const (
	NoOutput Verbosity = iota
	DefaultOutput
	VerboseOutput
	VeryVerboseOutput
	VeryVeryVerboseOutput
)

Jump to

Keyboard shortcuts

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