10 Write to /var/log/httpd/error_log. See
12 http://www.modpython.org/FAQ/faqw.py?req=edit&file=faq02.003.htp
15 def write(self, data):
16 sys.stderr.write(data)
21 def profile(callable):
23 Prints the runtime of the specified callable. Use as a decorator, e.g.,
37 result = profile(foo)(...)
40 def wrapper(*args, **kwds):
42 result = callable(*args, **kwds)
45 args += ["%s = %s" % (name, str(value)) for (name, value) in kwds.items()]
46 print >> log, "%s (%s): %f s" % (callable.__name__, ", ".join(args), end - start)
51 if __name__ == "__main__":
52 def sleep(seconds = 1):
55 sleep = profile(sleep)