Rev 3806: Update trace to log when the process started. in http://bzr.arbash-meinel.com/branches/bzr/jam-integration

John Arbash Meinel john at arbash-meinel.com
Thu Oct 30 00:44:06 GMT 2008


At http://bzr.arbash-meinel.com/branches/bzr/jam-integration

------------------------------------------------------------
revno: 3806
revision-id: john at arbash-meinel.com-20081030004355-k1kej1kdzcdo0360
parent: pqm at pqm.ubuntu.com-20081028202057-u3csau9zvf0hapya
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Wed 2008-10-29 19:43:55 -0500
message:
  Update trace to log when the process started.
  Also change the plugin loading code to ignore the __init__.py script
  which is always there.
  And change enabled_default_logging() so that we don't get an extra
  mutter() 'encoding stdout as ...'
-------------- next part --------------
=== modified file 'bzrlib/plugin.py'
--- a/bzrlib/plugin.py	2008-10-27 07:29:32 +0000
+++ b/bzrlib/plugin.py	2008-10-30 00:43:55 +0000
@@ -205,7 +205,9 @@
                     break
             else:
                 continue
-        if getattr(_mod_plugins, f, None):
+        if f == '__init__':
+            continue # We don't load __init__.py again in the plugin dir
+        elif getattr(_mod_plugins, f, None):
             trace.mutter('Plugin name %s already loaded', f)
         else:
             # trace.mutter('add plugin name %s', f)

=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py	2008-09-26 22:14:42 +0000
+++ b/bzrlib/trace.py	2008-10-30 00:43:55 +0000
@@ -234,23 +234,27 @@
 
 def enable_default_logging():
     """Configure default logging: messages to stderr and debug to .bzr.log
-    
+
     This should only be called once per process.
 
     Non-command-line programs embedding bzrlib do not need to call this.  They
     can instead either pass a file to _push_log_file, or act directly on
     logging.getLogger("bzr").
-    
+
     Output can be redirected away by calling _push_log_file.
     """
+    # Do this before we open the log file, so we prevent
+    # get_terminal_encoding() from mutter()ing multiple times
+    term_encoding = osutils.get_terminal_encoding()
     # create encoded wrapper around stderr
     bzr_log_file = _open_bzr_log()
     push_log_file(bzr_log_file,
         r'[%(process)5d] %(asctime)s.%(msecs)03d %(levelname)s: %(message)s',
         r'%Y-%m-%d %H:%M:%S')
+    mutter('enabling logging: %s', time.asctime())
     # after hooking output into bzr_log, we also need to attach a stderr
     # handler, writing only at level info and with encoding
-    writer_factory = codecs.getwriter(osutils.get_terminal_encoding())
+    writer_factory = codecs.getwriter(term_encoding)
     encoded_stderr = writer_factory(sys.stderr, errors='replace')
     stderr_handler = logging.StreamHandler(encoded_stderr)
     stderr_handler.setLevel(logging.INFO)



More information about the bazaar-commits mailing list