<commit_before>import json
import logging

from anymail.signals import tracking
from django.dispatch import receiver


logger = logging.getLogger(__name__)


@receiver(tracking, dispatch_uid="log_anymail_tracking_events")
def log_anymail_tracking_events(sender, event, esp_name, **kwargs):
    event_fields = [
        "event_type",
        "description",
        "mta_response",
        "recipient",
        "reject_reason",
    ]

    logger.info(
        json.dumps(
            {"esp_name": esp_name, **{f: getattr(event, f, None) for f in event_fields}}
        )
    )<commit_msg>Feat(webhook): Ajoute au log l'événement d'origine<commit_after>import json
import logging

from anymail.signals import tracking
from django.dispatch import receiver


logger = logging.getLogger(__name__)


@receiver(tracking, dispatch_uid="log_anymail_tracking_events")
def log_anymail_tracking_events(sender, event, esp_name, **kwargs):
    event_fields = [
        "event_type",
        "description",
        "mta_response",
        "recipient",
        "reject_reason",
        "esp_event",
    ]

    logger.info(
        json.dumps(
            {"esp_name": esp_name, **{f: getattr(event, f, None) for f in event_fields}}
        )
    )
{'fraction_non_alphanumeric': 0.10894308943089431, 'fraction_numerical': 0.0, 'mean_word_length': 3.2013651877133107, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6401609', 'n_tokens_mistral': 398, 'n_tokens_neox': 382, 'n_words': 84}