def audit_log(action, request_user, account_user, message, audit, request,
              level=logging.DEBUG):
    logger = logging.getLogger("audit_logger")
    extra = {
        'formhub_action': action,
        'request_username':
        request_user.username if request_user.username else str(request_user),
        'account_username':
        account_user.username if account_user.username else str(account_user),
        'client_ip': get_client_ip(request),
        'audit': audit
    }
    logger.log(level, message, extra=extra)
Create a log message based on these params
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/libs/utils/log.py/audit_log