[][src]Crate clout

Clout is a command line output library.

It provides a similar interface to the logging crate but with a different focus:

  • clout's output is opinionated and not pluggable like logging
  • clout provides output with sensible settings for use in command line tools
    • colours are supported for different message levels
    • output is always to stdout (for now)
    • different output levels are selected using settings aligned with typical command line argument conventions

Many libraries already output messages to the logging framework, and you generally don't want all these messages to get displayed to the end user. Clout allows you to generate output using a logging-style API without having to filter all these messages. (In fact you can use clout and logging together eg. by sending the logging messages to a file)

clout includes an additional level between Warn and Info, called Status - this is intended for most output messages. This is because typically CLI tools provide 3 levels of verbosity (-v, -vv, and -vvv is a common practice) but logging only provides two levels below info.

Macros

debug

Emit a debug message

error

Emit an error message

info

Emit an info message

status

Emit a status message

trace

Emit a trace message

warn

Emit a warning message

Structs

Builder

Builder to configuring clout

Enums

CloutError

Possible errors returned by clout

Level

The different levels of importance of a message Also used to determine what level of messages should be displayed

UseColor

Determine if clout should use colors for output

Functions

emit

Emit a message with a given level and format_args. Prefer the specific macros.

init

Construct a new Builder.

shutdown

Shutdown clout. Not strictly necessary, but frees memory.