ccu.cli package¶
Utilities, classes, and functions for CLI commands.
Submodules¶
ccu.cli.main module¶
Module that contains the command line app.
ccu.cli.utils module¶
Utilities for CLI commands.
- class ccu.cli.utils.FancyConsoleHandler(stream=None)[source]¶
Bases:
StreamHandlerA handler that prints colourful output to stderr.
Initialize the handler.
If stream is not specified, sys.stderr is used.
- emit(record: LogRecord)[source]¶
Emit a record using
click.secho.If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline in ANSI colours depending on the log level. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‘encoding’ attribute, it is used to determine how to do the output to the stream.
- ccu.cli.utils.configure_logging(console_log_level: int = 30, log_file: str | Path | None = None, file_log_level: int = 10) None[source]¶
Configure logging and printing for command-line functions.
- Parameters:
console_log_level – The log level for messages printed to the console. Defaults to logging.WARNING.
log_file – The file to which log messages will be sent. Defaults to None, in which case, no log messages are sent to a file.
file_log_level – The log level for messages sent to the log file. Defaults to logging.DEBUG.