benhoyt  <comp.lang.pyt...@googlegroups.com> wrote:
>This works, but as you can see, it's a bit hacky. Is there a better way to =
>fix it? (I'd like the fix to affect all loggers, including the root logger.=
>)

A simpler solution would be to caclulate the time it takes to the handle
the request using time.clock() and include it in the log message.
Something like:

        timer = time.time
        if sys.platform == 'win32':
                timer = time.clock

        def handler(...):
                start = timer()
                ...
                logging.debug("processing time %.0fms",
                              (timer() - start) * 1000)

Saves you from having to do the math in your head when you look at
the logs.

                                        Ross Ridge

-- 
 l/  //   Ross Ridge -- The Great HTMU
[oo][oo]  rri...@csclub.uwaterloo.ca
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //   
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to