import logging


def add_logger_to_app(app):
    """
    Add logger to the current app.

    :param app: Current app.
    :type app: eve.Eve
    :return: App with logger.
    :rtype: eve.Eve
    """
    handler = logging.FileHandler(app.config["LOGGING_PATH"])
    handler.setFormatter(
        logging.Formatter(
            '%(asctime)s %(levelname)s: %(message)s '
            '[in %(filename)s:%(lineno)d] -- ip: %(clientip)s, '
            'url: %(url)s, method:%(method)s'
        )
    )
    app.logger.setLevel(app.config["LOGGING_LEVEL"])
    app.logger.addHandler(handler)
    return app