8 Write to /var/log/httpd/error_log. See
10 http://www.modpython.org/FAQ/faqw.py?req=edit&file=faq02.003.htp
13 def write(self, data):
14 sys.stderr.write(data)
19 def profile(callable):
21 Prints the runtime of the specified callable. Use as a decorator, e.g.,
35 result = profile(foo)(...)
38 def wrapper(*args, **kwds):
40 result = callable(*args, **kwds)
43 args += ["%s = %s" % (name, str(value)) for (name, value) in kwds.items()]
44 print >> log, "%s (%s): %f s" % (callable.__name__, ", ".join(args), end - start)
49 if __name__ == "__main__":
50 def sleep(seconds = 1):
53 sleep = profile(sleep)