示例#1
0
 def perf_logged(*args, **kwargs):
     argnames = func.func_code.co_varnames[:func.func_code.co_argcount]
     fname = func.func_name
     module_name = func.func_code.co_filename.split("/")[-1].split('.')[0]
     req = args[0]
     if isinstance(req, HttpRequest) :
         entries = simple_params(zip(argnames[1:], args[1:]) + kwargs.items() + req.GET.items())
         msg = '%s %s -> %s.%s(%s)' % (req.method, req.META['PATH_INFO'], module_name, fname, ','.join('%s=%s' % entry for entry in entries))
     else:
         entries = simple_params(zip(argnames, args) + kwargs.items())
         msg = '%s.%s(%s)' % (module_name, fname, ','.join('%s=%s' % entry for entry in entries))
     startTime = time()
     retVal = func(*args, **kwargs)
     endTime = time()
     PERF_LOGGER.debug('%s <- %s ms.' % (msg, 1000 * (endTime - startTime)))
     return retVal
示例#2
0
 def perf_logged(*args, **kwargs):
     argnames = func.func_code.co_varnames[:func.func_code.co_argcount]
     fname = func.func_name
     module_name = func.func_code.co_filename.split("/")[-1].split('.')[0]
     req = args[0]
     if isinstance(req, HttpRequest):
         entries = simple_params(
             zip(argnames[1:], args[1:]) + kwargs.items() + req.GET.items())
         msg = '%s %s -> %s.%s(%s)' % (req.method, req.META['PATH_INFO'],
                                       module_name, fname, ','.join(
                                           '%s=%s' % entry
                                           for entry in entries))
     else:
         entries = simple_params(zip(argnames, args) + kwargs.items())
         msg = '%s.%s(%s)' % (module_name, fname, ','.join(
             '%s=%s' % entry for entry in entries))
     startTime = time()
     retVal = func(*args, **kwargs)
     endTime = time()
     PERF_LOGGER.debug('%s <- %s ms.' % (msg, 1000 * (endTime - startTime)))
     return retVal
    def perf_logged(*args, **kwargs):
        argnames = func.func_code.co_varnames[:func.func_code.co_argcount]
        fname = func.func_name
        module_name = func.func_code.co_filename.split("/")[-1].split('.')[0]
        entries = simple_params(zip(argnames, args) + kwargs.items())
        msg = '%s.%s(%s)' % (module_name, fname, ','.join('%s=%s' % entry for entry in entries))

        logging.debug(msg)
        start_time = time()
        ret_val = func(*args, **kwargs)
        end_time = time()
        PERF_LOGGER.debug('%s <- %s ms.' % (msg, 1000 * (end_time - start_time)))
        return ret_val
示例#4
0
    def perf_logged(*args, **kwargs):
        argnames = func.func_code.co_varnames[:func.func_code.co_argcount]
        fname = func.func_name
        module_name = func.func_code.co_filename.split("/")[-1].split('.')[0]
        entries = simple_params(zip(argnames, args) + kwargs.items())
        msg = '%s.%s(%s)' % (module_name, fname, ','.join(
            '%s=%s' % entry for entry in entries))

        logging.debug(msg)
        start_time = time()
        ret_val = func(*args, **kwargs)
        end_time = time()
        PERF_LOGGER.debug('%s <- %s ms.' % (msg, 1000 *
                                            (end_time - start_time)))
        return ret_val