At http://bzr.arbash-meinel.com/branches/bzr/brisbane/debug_hacks

------------------------------------------------------------
revno: 3807
revision-id: [email protected]
parent: [email protected]
committer: John Arbash Meinel <[email protected]>
branch nick: debug_hacks
timestamp: Tue 2008-12-23 11:17:50 -0600
message:
  Add a flush call to mutter()
=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py   2008-11-01 14:44:47 +0000
+++ b/bzrlib/trace.py   2008-12-23 17:17:50 +0000
@@ -129,9 +129,11 @@
 info = note
 log_error = _bzr_logger.error
 error =     _bzr_logger.error
+_last_mutter_flush_time = None
 
 
 def mutter(fmt, *args):
+    global _last_mutter_flush_time
     if _trace_file is None:
         return
     if (getattr(_trace_file, 'closed', None) is not None) and 
_trace_file.closed:
@@ -152,11 +154,16 @@
         out = fmt % tuple(real_args)
     else:
         out = fmt
-    timestamp = '%0.3f  ' % (time.time() - _bzr_log_start_time,)
+    now = time.time()
+    timestamp = '%0.3f  ' % (now - _bzr_log_start_time,)
     out = timestamp + out + '\n'
     _trace_file.write(out)
     # no need to flush here, the trace file is now linebuffered when it's
     # opened.
+    if (_last_mutter_flush_time is None
+        or (now - _last_mutter_flush_time) > 2.0):
+        _trace_file.flush()
+        _last_mutter_flush_time = now
 
 
 def mutter_callsite(stacklevel, fmt, *args):

-- 
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits

Reply via email to