Rev 3811: (jam) A bit of cleanup for the default entries in the trace log. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Oct 30 14:52:25 GMT 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3811
revision-id: pqm at pqm.ubuntu.com-20081030145221-fog9qrw59bobguy0
parent: pqm at pqm.ubuntu.com-20081030101459-f6su1v261s1rwtah
parent: john at arbash-meinel.com-20081030141826-6267bwt9p372nrsi
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-10-30 14:52:21 +0000
message:
  (jam) A bit of cleanup for the default entries in the trace log.
modified:
  bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
  bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
    ------------------------------------------------------------
    revno: 3805.2.3
    revision-id: john at arbash-meinel.com-20081030141826-6267bwt9p372nrsi
    parent: john at arbash-meinel.com-20081030005500-r5cej1cxflqhs3io
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: jam-integration
    timestamp: Thu 2008-10-30 09:18:26 -0500
    message:
      Use osutils.format_local_date() instead of time.strftime()
    modified:
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
    ------------------------------------------------------------
    revno: 3805.2.2
    revision-id: john at arbash-meinel.com-20081030005500-r5cej1cxflqhs3io
    parent: john at arbash-meinel.com-20081030004355-k1kej1kdzcdo0360
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: jam-integration
    timestamp: Wed 2008-10-29 19:55:00 -0500
    message:
      Switch so that we are using a simple timestamp as the first action.
    modified:
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
    ------------------------------------------------------------
    revno: 3805.2.1
    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 ...'
    modified:
      bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
=== 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 14:18:26 +0000
@@ -234,23 +234,29 @@
 
 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()
+    start_time = osutils.format_local_date(_bzr_log_start_time,
+                                           timezone='local')
     # create encoded wrapper around stderr
     bzr_log_file = _open_bzr_log()
+    bzr_log_file.write(start_time.encode('utf-8') + '\n')
     push_log_file(bzr_log_file,
         r'[%(process)5d] %(asctime)s.%(msecs)03d %(levelname)s: %(message)s',
         r'%Y-%m-%d %H:%M:%S')
     # 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