Skip to content

console

flavor.console

TODO: Add module docstring.

Functions

echo

echo(message: str, **kwargs: Any) -> None

Output a message to stdout with automatic Unicode handling.

Uses Foundation's pout() which handles Unicode and terminal compatibility automatically.

Parameters:

Name Type Description Default
message str

Message to output

required
**kwargs Any

Additional arguments (currently unused, for compatibility)

{}
Source code in flavor/console.py
def echo(message: str, **kwargs: Any) -> None:
    """
    Output a message to stdout with automatic Unicode handling.

    Uses Foundation's pout() which handles Unicode and terminal
    compatibility automatically.

    Args:
        message: Message to output
        **kwargs: Additional arguments (currently unused, for compatibility)
    """
    pout(message)

echo_error

echo_error(message: str, **kwargs: Any) -> None

Output an error message to stderr with automatic Unicode handling.

Uses Foundation's perr() which handles Unicode and terminal compatibility automatically.

Parameters:

Name Type Description Default
message str

Error message to output

required
**kwargs Any

Additional arguments (currently unused, for compatibility)

{}
Source code in flavor/console.py
def echo_error(message: str, **kwargs: Any) -> None:
    """
    Output an error message to stderr with automatic Unicode handling.

    Uses Foundation's perr() which handles Unicode and terminal
    compatibility automatically.

    Args:
        message: Error message to output
        **kwargs: Additional arguments (currently unused, for compatibility)
    """
    perr(message)

get_command_logger

get_command_logger(command_name: str) -> Any

Get a structured logger for a command.

The logger uses Foundation's DAS (Duration/Action/Status) event system which automatically prefixes logs with appropriate emojis based on the event type and context.

Parameters:

Name Type Description Default
command_name str

Name of the command (e.g., 'pack', 'verify')

required

Returns:

Type Description
Any

Configured structlog logger with DAS emoji prefixing

Example

log = get_command_logger("pack") log.debug("Starting packaging process", manifest=manifest_path) log.info("Package built successfully", output=output_path) log.error("Packaging failed", error=str(e))

Source code in flavor/console.py
def get_command_logger(command_name: str) -> Any:
    """
    Get a structured logger for a command.

    The logger uses Foundation's DAS (Duration/Action/Status) event system
    which automatically prefixes logs with appropriate emojis based on the
    event type and context.

    Args:
        command_name: Name of the command (e.g., 'pack', 'verify')

    Returns:
        Configured structlog logger with DAS emoji prefixing

    Example:
        log = get_command_logger("pack")
        log.debug("Starting packaging process", manifest=manifest_path)
        log.info("Package built successfully", output=output_path)
        log.error("Packaging failed", error=str(e))
    """
    return get_logger(f"flavor.commands.{command_name}")