• Jeremy Hylton's avatar
    Clean-ups and speed-ups to the default log implementation. · fd97a65e
    Jeremy Hylton authored
    This change includes a minor change to semantics for
    reinitialization().
    
    There are three chief performance-related changes:
    
        - Do not check whether logging is enabled in the actual log call.
          Instead check enviroment variables when the module is imported
          and whenever an explicit initialize() call is made.
    
          This might seem like it limits the user's ability to turn
          logging on and off, but I don't believe it does.  Logging is
          controlled by environment variables.  Once the Python script is
          working, the environment variables won't change.
    
          This change makes the case of no logging fast, instead of slow.
    
        - Each log call goes through a method on the stupid_log_write()
          object instead of through __call__().  It's much faster to call
          a method than an instance.
    
        - Use "print >> file" rather than "file.write()".  It appears to
          be a bit faster.
    
    Replaced _set_stupid_dest() with _set_log_dest().
    fd97a65e
MinimalLogger.py 5.93 KB