Documentation
¶
Overview ¶
Package progress carries transient operation messages through a context to an optional observer.
Report serializes callbacks from concurrent operations. Observers must return promptly and avoid recursive reporting. Messages describe activity in the current process; what lasts is recorded in the store, and read from there.
Package progress carries user-facing progress reports from operations to whoever is watching: the CLI prints them, a check's run keeps the ones a person following it needs, and tests collect them. Nothing decides anything by them. Reports are sentences for a person, not log lines.
Index ¶
- func After(ctx context.Context, delay time.Duration, format string, args ...any) (stop func())
- func DebugReport(ctx context.Context, format string, args ...any)
- func Keep(ctx context.Context, keep func(Update)) context.Context
- func Observe(ctx context.Context, observe func(Update)) context.Context
- func Quiet(ctx context.Context) context.Context
- func Report(ctx context.Context, format string, args ...any)
- func ReportOnce(ctx context.Context, format string, args ...any)
- func VerboseReport(ctx context.Context, format string, args ...any)
- func WithReporter(ctx context.Context, report func(Update)) context.Context
- func Within(ctx context.Context, about string) context.Context
- type Level
- type Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func After ¶ added in v0.4.0
After reports, once, at info level, what a step waits on, where it has run for longer than delay: the first outdated after a rebuild printed nothing for 13 minutes, waiting on something it didn't say (field testing at c9ad2112). A step that ends sooner says nothing. stop ends the wait, and is safe to call more than once.
func DebugReport ¶
DebugReport emits a report about a sub-operation.
func Keep ¶
Keep is Observe for an observer that keeps the info reports made under ctx for whoever follows the work, as a check's run keeps each environment's: a command driving it Quiet shows them through that record, so its reporter lowers them to debug rather than verbose, and -v doesn't show each twice, once bare and once kept (the hugo exercise's check-64).
func Observe ¶
Observe has the reports made under ctx go to observe as well as to the reporter, at the level they were made: Quiet lowers what a command shows of the work it drives, not what the work's own record keeps. Callbacks are serialized; observe should return promptly and must not report under the context Observe returns.
func Quiet ¶
Quiet lowers the info reports made under ctx to verbose. A command that drives the workflow only to see its own job through is not the driver's audience: what the engine and providers say as they work is the work behind the scenes to it, and its own narrative says what matters. A resident driver reports under the plain context and keeps every line.
func ReportOnce ¶
ReportOnce emits an info-level report the first time it's made to the command's reporter, and not again: a notice about the work, such as a port being a stub, that each pass over the same work would repeat.
func VerboseReport ¶
VerboseReport emits a report for people who asked for more.
func WithReporter ¶
WithReporter serializes callbacks, including those from concurrent operations. The callback should return promptly and must not report recursively.