code: def ModuleLogger(globs):
      
      # make sure that _debug is defined
      if not globs.has_key('_debug'):
          raise RuntimeError("define _debug before creating a module logger")
  
      # logger name is the module name
      logger_name = globs['__name__']
  
      # create a logger to be assigned to _log
      logger = logging.getLogger(logger_name)
  
      # put in a reference to the module globals
      logger.globs = globs
  
      # if this is a "root" logger add a default handler for warnings and up
      if '.' not in logger_name:
          hdlr = logging.StreamHandler()
          hdlr.setLevel(logging.WARNING)
          hdlr.setFormatter(logging.Formatter(logging.BASIC_FORMAT, None))
          logger.addHandler(hdlr)
  
      return logger
docs: Create a module level logger.
  
      To debug a module, create a _debug variable in the module, then use the
      ModuleLogger function to create a "module level" logger.  When a handler
      is added to this logger or a child of this logger, the _debug variable will
      be incremented.
  
      All of the calls within functions or class methods within the module should
      first check to see if _debug is set to prevent calls to formatter objects
      that aren't necessary.