[ZODB-Dev] profiling zLOG and inspect
Guido van Rossum
guido at python.org
Sun Jun 15 22:32:47 EDT 2003
> I'm concerned with startup cost; however, zLOG is used throughout the
> ZODB code, which means that `turning it off' is more involved than
> simply avoiding the import. I was proposing to define a stub zLOG.LOG().
So the best solution is to create a dummy module, as follows:
########################################
import os, sys
def LOG(*args):
pass
if not os.environ.has_key("STUPID_LOG_FILE"):
sys.modules["zLOG"] = sys.modules[__name__]
########################################
Now make sure this is imported in your main program before zLOG or
ZODB are imported.
The mysterious last line makes "import zLOG" return the dummy module
instead.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the ZODB-Dev
mailing list