Quiet and Verbose Command Output
A command can provide different levels of diagnostic detail while preserving its documented data output and success signal.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a status update
A quiet mode may skip progress lines while still emitting an error when reading fails. A verbose mode may add steps and timings. Use separate output streams so data consumers receive the same shape.
Test the promised boundary
Compare logical results and exit status under both modes for an ordinary input and a failed one. Avoid including private source data in extra output. Diagnostic logging explains what context suffices.[1]
Preserve machine data when changing diagnostic verbosity
A command reporting count three can print the same result under quiet and verbose options. A verbose run might additionally send progress to standard error. Reserved output channels allow a pipeline to keep working across these modes. See data on standard output.
Quiet stdout: {"count":3}
Verbose stdout: {"count":3}
Verbose stderr: input processed, time elapsed
Compare observable data separately from diagnostic detail
Set expectations for failures as well as progress
Quiet mode can still need a clear failure indication and nonzero status. Verbose mode should avoid exposing inappropriate data. Test the same successful and invalid inputs under both options.