def create(user, type, certificate=None):
    """
    Creates logs a given action.

    :param user:
    :param type:
    :param certificate:
    :return:
    """
    log_data = {
        "function": "lemur-audit",
        "action": type,
        "user": user.email,
        "certificate": certificate.name,
        "message": f"[lemur-audit] action: {type}, user: {user.email}, certificate: {certificate.name}."
    }
    # format before August 2021: f"[lemur-audit] action: {type}, user: {user.email}, certificate: {certificate.name}."
    current_app.logger.info(log_data)

    view = Log(user_id=user.id, log_type=type, certificate_id=certificate.id)
    database.add(view)
    database.commit()

    Creates logs a given action.

    :param user:
    :param type:
    :param certificate:
    :return:
    
lemur/logs/service.py