<commit_before>import logging
from .libpynexmo.nexmomessage import NexmoMessage
from django.conf import settings

logger = logging.getLogger(__name__)

outbox = []

def send_message(to, message):
    """Shortcut to send a sms using libnexmo api.

    Usage:

    >>> from nexmo import send_message
    >>> send_message('+33612345678', 'My sms message body')
    """
    params = {
        'api_key': settings.NEXMO_USERNAME,
        'api_secret': settings.NEXMO_PASSWORD,
        'type': 'unicode',
        'from': settings.NEXMO_FROM,
        'to': to,
        'text': message.encode('utf-8'),
    }

    sms = NexmoMessage(params)

    if settings.NEXMO_LOG:
        logger.info(u'Nexmo outbound SMS to: %s, message: %s' % (
            sms.to,
            sms.text,
        ))

    if settings.NEXMO_TEST_MODE:
        outbox.append(sms)
    else:
        response = sms.send_request()
        return response

    return False<commit_msg>fix logging bug<commit_after>import logging
from .libpynexmo.nexmomessage import NexmoMessage
from django.conf import settings

logger = logging.getLogger(__name__)

outbox = []

def send_message(to, message):
    """Shortcut to send a sms using libnexmo api.

    Usage:

    >>> from nexmo import send_message
    >>> send_message('+33612345678', 'My sms message body')
    """
    params = {
        'api_key': settings.NEXMO_USERNAME,
        'api_secret': settings.NEXMO_PASSWORD,
        'type': 'unicode',
        'from': settings.NEXMO_FROM,
        'to': to,
        'text': message.encode('utf-8'),
    }

    sms = NexmoMessage(params)

    if settings.NEXMO_LOG:
        logger.info(u'Nexmo outbound SMS to: %s, message: %s' % (
            sms.sms.to,
            sms.sms.text,
        ))

    if settings.NEXMO_TEST_MODE:
        outbox.append(sms)
    else:
        response = sms.send_request()
        return response

    return False
{'fraction_non_alphanumeric': 0.11615628299894404, 'fraction_numerical': 0.012671594508975714, 'mean_word_length': 2.4898710865561693, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4688915', 'n_tokens_mistral': 659, 'n_tokens_neox': 616, 'n_words': 141}