Rev 3807: Add a flush call to mutter() in http://bzr.arbash-meinel.com/branches/bzr/brisbane/debug_hacks
John Arbash Meinel
john at arbash-meinel.com
Tue Dec 23 17:18:05 GMT 2008
At http://bzr.arbash-meinel.com/branches/bzr/brisbane/debug_hacks
------------------------------------------------------------
revno: 3807
revision-id: john at arbash-meinel.com-20081223171750-pker2zueia9u5gs2
parent: john at arbash-meinel.com-20081223170918-5y3wgrpl1qp9j86y
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: debug_hacks
timestamp: Tue 2008-12-23 11:17:50 -0600
message:
Add a flush call to mutter()
-------------- next part --------------
=== 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):
More information about the bazaar-commits
mailing list