chaturbate_poller.logging_config

Logging configuration for the chaturbate_poller package.

Attributes

URL_REGEX

TOKEN_REGEX

timezone_name

Classes

SanitizeSensitiveDataFilter

Filter to sanitize sensitive data from logs.

CustomJSONFormatter

Custom JSON Formatter for structured logging.

Functions

sanitize_sensitive_data(→ str | int | float)

Sanitize sensitive data like URLs and tokens.

setup_logging(→ None)

Set up logging configuration.

Module Contents

chaturbate_poller.logging_config.URL_REGEX
chaturbate_poller.logging_config.TOKEN_REGEX
chaturbate_poller.logging_config.timezone_name
chaturbate_poller.logging_config.sanitize_sensitive_data(arg: str | float) str | int | float[source]

Sanitize sensitive data like URLs and tokens.

Parameters:

arg (str | float) – The argument to sanitize.

Returns:

Sanitized data.

Return type:

str | int | float

class chaturbate_poller.logging_config.SanitizeSensitiveDataFilter(name='')[source]

Bases: logging.Filter

Filter to sanitize sensitive data from logs.

filter(record: logging.LogRecord) bool[source]

Sanitize sensitive data in log messages and arguments.

Parameters:

record (logging.LogRecord) – The log record.

Returns:

Whether to process the log.

Return type:

bool

class chaturbate_poller.logging_config.CustomJSONFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)[source]

Bases: json_log_formatter.JSONFormatter

Custom JSON Formatter for structured logging.

json_record(message: str, extra: dict[str, Any], record: logging.LogRecord) dict[str, Any][source]

Add extra fields to the JSON log record.

Parameters:
  • message (str) – The log message.

  • extra (dict[str, Any]) – Additional log data.

  • record (logging.LogRecord) – The log record.

Returns:

Enhanced log record.

Return type:

dict[str, Any]

chaturbate_poller.logging_config.setup_logging(*, verbose: bool = False) None[source]

Set up logging configuration.

Parameters:

verbose (bool) – Enable verbose logging (DEBUG level).