Skip to content

KafkaLoggingMixin

faststream.confluent.shared.logging.KafkaLoggingMixin #

KafkaLoggingMixin(*args: Any, logger: Optional[Logger] = access_logger, log_level: int = logging.INFO, log_fmt: Optional[str] = None, **kwargs: Any)

Bases: LoggingMixin

A class that provides logging functionality for Kafka.

METHOD DESCRIPTION
__init__

initializes the KafkaLoggingMixin object

_get_log_context

returns the log context for a given message and topics

fmt

returns the log format string

_setup_log_context

sets up the log context for a given list of topics

Initialize the class.

PARAMETER DESCRIPTION
*args

Variable length argument list

TYPE: Any DEFAULT: ()

logger

Optional logger object

TYPE: Optional[Logger] DEFAULT: access_logger

log_level

Log level (default: logging.INFO)

TYPE: int DEFAULT: INFO

log_fmt

Optional log format string

TYPE: Optional[str] DEFAULT: None

**kwargs

Arbitrary keyword arguments

TYPE: Any DEFAULT: {}

RETURNS DESCRIPTION
None

None

Source code in faststream/confluent/shared/logging.py
def __init__(
    self,
    *args: Any,
    logger: Optional[logging.Logger] = access_logger,
    log_level: int = logging.INFO,
    log_fmt: Optional[str] = None,
    **kwargs: Any,
) -> None:
    """Initialize the class.

    Args:
        *args: Variable length argument list
        logger: Optional logger object
        log_level: Log level (default: logging.INFO)
        log_fmt: Optional log format string
        **kwargs: Arbitrary keyword arguments

    Returns:
        None

    """
    super().__init__(
        *args,
        logger=logger,
        log_level=log_level,
        log_fmt=log_fmt,
        **kwargs,
    )
    self._max_topic_len = 4
    self._max_group_len = 0

fmt property #

fmt: str

log_level instance-attribute #

log_level = log_level

logger instance-attribute #

logger = logger