/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Andrew Bennetts
  • Date: 2008-01-21 00:46:32 UTC
  • mfrom: (3193 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3194.
  • Revision ID: andrew.bennetts@canonical.com-20080121004632-wvpox6g9j7czn4vk
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
import os
56
56
import sys
57
57
import re
 
58
import time
58
59
 
59
60
from bzrlib.lazy_import import lazy_import
60
61
lazy_import(globals(), """
82
83
_trace_depth = 0
83
84
_bzr_log_file = None
84
85
_bzr_log_filename = None
 
86
_bzr_log_opened = None
85
87
 
86
88
 
87
89
# configure convenient aliases for output routines
127
129
    else:
128
130
        out = fmt
129
131
    out += '\n'
 
132
    if 'times' in debug.debug_flags:
 
133
        global _bzr_log_opened
 
134
        if _bzr_log_opened is None:
 
135
            # This is the first mutter since the process started.  Start the
 
136
            # clock from now.
 
137
            _bzr_log_opened = time.time()
 
138
        timestamp = '%0.3f' % (time.time() - _bzr_log_opened,)
 
139
        out = '%s %s' % (timestamp, out)
130
140
    _trace_file.write(out)
131
141
    # TODO: jam 20051227 Consider flushing the trace file to help debugging
132
142
    #_trace_file.flush()