<commit_before># -*- coding: utf-8 -*-
import logging
import threading
import pika
from pika import credentials
from formatters import JSONFormatter
from filters import FieldFilter


class RabbitMQHandler(logging.Handler):
    """
    Django/Python logging handler to ship logs to RabbitMQ.
    Inspired by: https://github.com/ziXiong/MQHandler
    """

    def __init__(self, level=logging.NOTSET, formatter=JSONFormatter(),
                 host='localhost', port=5672, connection_params=None,
                 username=None, password=<PASSWORD>,
                 exchange='log', declare_exchange=False,
                 fields=None, fields_under_root=True):
        """
        Initialize the handler.

        :param level:             Logs level.
        :param formatter:         Use custom formatter for the logs.
        :param host:              RabbitMQ host. Default localhost
        :param port:              RabbitMQ Port. Default 5672<commit_msg>Unused import.<commit_after># -*- coding: utf-8 -*-
import logging
import pika
from pika import credentials
from formatters import JSONFormatter
from filters import FieldFilter


class RabbitMQHandler(logging.Handler):
    """
    Django/Python logging handler to ship logs to RabbitMQ.
    Inspired by: https://github.com/ziXiong/MQHandler
    """

    def __init__(self, level=logging.NOTSET, formatter=JSONFormatter(),
                 host='localhost', port=5672, connection_params=None,
                 username=None, password=<PASSWORD>,
                 exchange='log', declare_exchange=False,
                 fields=None, fields_under_root=True):
        """
        Initialize the handler.

        :param level:             Logs level.
        :param formatter:         Use custom formatter for the logs.
        :param host:              RabbitMQ host. Default localhost
        :param port:              RabbitMQ Port. Default 5672
{'fraction_non_alphanumeric': 0.08551941238195174, 'fraction_numerical': 0.00944386149003148, 'mean_word_length': 2.36331569664903, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2996946', 'n_tokens_mistral': 511, 'n_tokens_neox': 478, 'n_words': 146}