def add_info_log(message, logger):
    """ Function for creating INFO log entry
    :param message: log message, provided by functions down below
    :param logger: instance of logger
    :return: log entry to the logger's log
    """
    return logger.info(message)


def add_error_log(message, logger):
    """ Function for creating ERROR log entry
    :param message: log message, provided by functions down below
    :param logger: instance of logger
    :return: log entry to the logger's log
    """
    return logger.error(message)


def add_warning_log(message, logger):
    """ Function for creating WARNING log entry
    :param message: log message, provided by functions down below
    :param logger: instance of logger
    :return: log entry to the logger's log
    """
    return logger.warning(message)


def url_access_log(request):
    """ Function for creating a log entry for accessing url
    :param request: get view request for forming the url name
    :param user: get current user which trying t    o acess url
    :return: string for log entry
    """
    user = request.user
    url = request.get_full_path()
    return f"User [{user}] accessed <{url}> page"


def object_create_log(instance, obj_type, user=None):
    """ Create log string for object create request
    :param user: Who create object
    :param instance: Object's instance (model)
    :return: String with log record
    """
    if user:
        return f'User [{user}] created new [{obj_type}] - [{instance}]'
    else:
        return f'Unknown user created new [{obj_type}] - [{instance}]'


def object_list_log(user, obj_type):
    """ Create log string for object list request
    :param user: Who create object
    :param obj_type: Object's type
    :return: String with log record
    """
    return f'User [{user}] request a list of [{obj_type}]'


def object_retrieve_log(user, instance, obj_type):
    """ Create log string for object retrieve
    :param user: Who send request
    :param instance: Retrieved instance
    :return:String with log record
    """
    return f'User [{user}] retrieve an object [{instance}]  of type [{obj_type}]'


def object_update_log(user, instance, obj_type):
    """ Create log string for object update
    :param user: Who send request
    :param instance: Updated instance
    :return: String with log record
    """
    return f'User [{user}] perform update of object [{instance}] of type [{obj_type}]'


def object_destroy_log(user, instance, obj_type):
    """ Create log string for object destroy
    :param user: Who send request
    :param instance: Destroyed instance
    :return: String with log record
    """
    return f'User [{user}] perform destroy of object [{instance}] of type [{obj_type}]'


def form_errors(user, errors):
    """ Create log string for form validation errors
    :param user: User, who fill the form
    :param errors: List of errors
    :return:String with log record
    """
    return f'User [{user}] has form errors: [{errors}]'
