ocebuild.cli.logging
#
CLI Logging Utilities.
Module Contents#
Functions#
|
Stylized echo for the CLI. |
|
Prints a debug message. |
|
Prints an info message. |
|
Prints a success message. |
|
Stylized error message for the CLI. |
|
Stylized abort message for the CLI. |
- ocebuild.cli.logging.echo(msg: str = '', *args, log: bool = True, **kwargs) None [source]#
Stylized echo for the CLI.
- Parameters:
msg – The message to print.
*args – Additional arguments to pass to console.print().
**kwargs – Additional keyword arguments to pass to console.print().
Example
>>> echo('This is a message.') # -> This is a message.
- ocebuild.cli.logging.debug(msg: str, *args, **kwargs)[source]#
Prints a debug message.
This function is a wrapper for echo() that only prints if the global DEBUG flag is set.
- ocebuild.cli.logging.info(msg: str, *args, **kwargs)[source]#
Prints an info message.
This function is a wrapper for echo() that only prints if the global VERBOSE flag is set.
- ocebuild.cli.logging.error(msg: str, hint: str | None = None, label: str = 'ERROR', traceback: bool = False, suppress: List[str] | None = None, hide_locals: bool = False, **kwargs) None [source]#
Stylized error message for the CLI.
- Parameters:
msg – The error message to print.
label – The label to print before the error message.
hint – A hint to print after the error message. (Optional)
traceback – Whether to print a traceback. (Optional)
suppress – A list of filepaths to suppress from the traceback. (Optional)
Example
>>> error('This is an error message.') # -> Error: This is an error message.
- ocebuild.cli.logging.abort(msg: str, hint: str | None = None, traceback: bool = True) None [source]#
Stylized abort message for the CLI.
This function is a wrapper for error() that exits with a non-zero exit code. By default, a full traceback is printed using wrap_exception(), hiding internal stack frames.
- Parameters:
msg – The abort message to print.
hint – A hint to print after the abort message. (Optional)
traceback – Whether to print a traceback; enabled by default. (Optional)
Example
>>> abort('This is an abort message.') # -> Abort: This is an abort message. # (rich.console `print_exception()` traceback)