<commit_before>import logging

from django_statsd.clients import statsd

logger = logging.getLogger(__name__)


def log_user_created(sender, instance, created, **kwargs):
    if created:
        statsd.incr("user.created")

        logger.info(
            "User created",
            extra={
                "USERNAME": instance.username,
                "IS_STAFF": unicode(instance.is_staff),
                "IS_ACTIVE": unicode(instance.is_active),
                "IS_SUPERUSER": unicode(instance.is_superuser),
            },
        )


def log_user_modified(sender, instance, **kwargs):
    try:
        sender.objects.get(pk=instance.pk)
    except sender.DoesNotExist:
        return

    statsd.incr("user.modified")

    logger.info(
        "User modified",
        extra={
            "USERNAME": instance.username,
            "IS_STAFF": unicode(instance.is_staff),
            "IS_ACTIVE": unicode(instance.is_active),
            "IS_SUPERUSER": unicode(instance.is_superuser),
        },
    )<commit_msg>Remove usage of statsd<commit_after>import logging

logger = logging.getLogger(__name__)


def log_user_created(sender, instance, created, **kwargs):
    logger.info(
        "User created",
        extra={
            "USERNAME": instance.username,
            "IS_STAFF": unicode(instance.is_staff),
            "IS_ACTIVE": unicode(instance.is_active),
            "IS_SUPERUSER": unicode(instance.is_superuser),
        },
    )


def log_user_modified(sender, instance, **kwargs):
    try:
        sender.objects.get(pk=instance.pk)
    except sender.DoesNotExist:
        return

    logger.info(
        "User modified",
        extra={
            "USERNAME": instance.username,
            "IS_STAFF": unicode(instance.is_staff),
            "IS_ACTIVE": unicode(instance.is_active),
            "IS_SUPERUSER": unicode(instance.is_superuser),
        },
    )
{'fraction_non_alphanumeric': 0.11615628299894404, 'fraction_numerical': 0.0, 'mean_word_length': 2.3013937282229966, 'pattern_counts': {'":': 16, '<': 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': '5373425', 'n_tokens_mistral': 571, 'n_tokens_neox': 545, 'n_words': 95}