Skip to content

Rich handler

This page is auto-generated for HandlerType.Rich.

Spec

  • Handler type: Rich (rich)
  • Handler class: FormattedRichHandler
  • Handler class FQDN: daqpytools.logging.rich_handler.FormattedRichHandler
  • Factory: _build_rich_handler
  • Factory FQDN: daqpytools.logging.handlers._build_rich_handler
  • Fallback types: rich
  • Summary: Build the rich console handler.

Factory API

daqpytools.logging.handlers._build_rich_handler(width=None, **_)

Build the rich console handler.

This factory is invoked from handler resolution in get_daq_logger and receives forwarded **extras.

Parameters:

Name Type Description Default
width int | None

Optional console width used by FormattedRichHandler. If None, terminal width is auto-detected via get_width.

None
**_ object

Additional forwarded keyword arguments. Ignored by this factory.

{}

Returns:

Type Description
Handler

The configured rich logging handler.

Source code in daqpytools/logging/handlers.py
def _build_rich_handler(width: int | None = None, **_: object) -> logging.Handler:
    """Build the rich console handler.

    This factory is invoked from handler resolution in ``get_daq_logger`` and
    receives forwarded ``**extras``.

    Args:
        width: Optional console width used by ``FormattedRichHandler``.
            If ``None``, terminal width is auto-detected via ``get_width``.
        **_: Additional forwarded keyword arguments. Ignored by this factory.

    Returns:
        The configured rich logging handler.
    """
    real_width = width if width is not None else get_width()
    return FormattedRichHandler(width=real_width)