9 Write to /var/log/httpd/error_log. See
11 http://www.modpython.org/FAQ/faqw.py?req=edit&file=faq02.003.htp
14 def write(self, data):
15 sys.stderr.write(data)
20 def profile(callable):
22 Prints the runtime of the specified callable. Use as a decorator, e.g.,
36 result = profile(foo)(...)
39 def wrapper(*args, **kwds):
41 result = callable(*args, **kwds)
44 args += ["%s = %s" % (name, str(value)) for (name, value) in kwds.items()]
45 print >> log, "%s (%s): %f s" % (callable.__name__, ", ".join(args), end - start)
50 if __name__ == "__main__":
51 def sleep(seconds = 1):
54 sleep = profile(sleep)