Codebase list golang-github-vbauerster-mpb / a90ca6d
quietMode example with io.Discard Vladimir Bauer 3 years ago
1 changed file(s) with 2 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
22 import (
33 "flag"
44 "fmt"
5 "io"
56 "math/rand"
67 "sync"
78 "time"
2223 // passed wg will be accounted at p.Wait() call
2324 p := mpb.New(
2425 mpb.WithWaitGroup(&wg),
25 mpb.ContainerOptional(
26 // setting to nil will:
27 // set output to ioutil.Discard and disable refresh rate cycle, in
28 // order not to consume much CPU. Hovewer a single refresh still will
29 // be triggered on bar complete event, per each bar.
30 mpb.WithOutput(nil),
31 quietMode,
32 ),
26 mpb.ContainerOptional(mpb.WithOutput(io.Discard), quietMode),
3327 )
3428 total, numBars := 100, 3
3529 wg.Add(numBars)