Wrap a Bottle request so that a log line is emitted after it's handled.

def log_to_logger(fn):
    """
    Wrap a Bottle request so that a log line is emitted after it's handled.

    """
    @wraps(fn)
    def _log_to_logger(*args, **kwargs):
        actual_response = fn(*args, **kwargs)
        # modify this to log exactly what you need:
        logger.info('%s %s %s %s' % (bottle.request.remote_addr,
                                     bottle.request.method,
                                     bottle.request.url,
                                     bottle.response.status))
        return actual_response
    return _log_to_logger