def request_timing(handler, registry):
    threshold = float(registry.settings.get(
        'request_timing.slow_request_threshold', 2))
    log.info('request_timing enabled: slow_request_threshold = %s' % threshold)

    def timing(request):

        start = time.time()
        try:
            return handler(request)
        finally:
            delta = time.time() - start
            msg = '%s (%s) request took %s seconds' % (
                request.method, request.url, delta)
            if delta > threshold:
                log.warning(msg)
            else:
                log.debug(msg)

    return timing
dataset/ETHPy150Open ramses-tech/nefertari/nefertari/tweens.py/request_timing/original