Crate cli_toolbox[][src]

Expand description

Utility library for working with cli output ergonomically.

This is not a logging alternative, it’s intended to produce output for end user consumption.

It handles three levels of verbosity that can be set dynamically at runtime:

  • Quite - no output
  • Terse - used to provide minimal user output
  • Verbose - used to provide elaborated and/or additional user output

Output Macros

  • debug! - conditionally compiled console debugging output - [debug]

  • report! - conditional console output according to verbosity level - [debug|release]

* debug! is intended to be used during application development

* all other debugging and telemetry output is most likely better served with a logging library

Conditional Code Evaluation

  • eval! - conditional code execution according to verbosity level - [debug|release]

  • release! - conditional code execution according to verbosity level - [release]

Macros

Conditionally prints to io::stdout or evaluates an expression when the code is compiled unoptimized with debug assertions, otherwise does not include the message or expression. for a message a new line is not appended

Conditionally prints to io::stdout when the code is compiled unoptimized with debug assertions, otherwise does not include the message. a new line is appended

Conditionally evaluates expressions when intended verbosity matches active verbosity.

Conditionally evaluates expressions when intended verbosity matches active verbosity and only when the code is compiled optimized.

Conditionally prints to io::stdout or io::stderr when intended verbosity matches active verbosity,
does not append a new line.

Conditionally prints to io::stdout or io::stderr when intended verbosity matches active verbosity,
appends a new line.