'`RedactedLogRecord` custom LogRecord obfuscates API key logging.'

def test_api_key_log_obfuscation(self):

    logging.LogRecord = RedactedLogRecord
    logger = logging.getLogger()
    handler = MockLoggingHandler()
    logger.setLevel(logging.DEBUG)
    logger.addHandler(handler)
    def log_api_key():
        '\n                                                Log    things,    including    an    API    key.\n                                                '
        mtype = 'metrics'
        endpoint = 'dd_url'
        url = 'https://x-x-x-app.agent.datadog.com/intake/?api_key=foobar'
        logger.info(u'Sending    %s    to    endpoint    %s    at    %s', mtype, endpoint, url)
    log_api_key()
    result = handler.pop()
    expected_result = u'Sending    metrics    to    endpoint    dd_url    at    https://x-x-x-app.agent.datadog.com/intake/?api_key=*************************oobar'
    self.assertEquals(result, expected_result)
