~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Martin Pool
  • Date: 2007-07-02 04:48:41 UTC
  • mto: This revision was merged to the branch mainline in revision 2567.
  • Revision ID: mbp@sourcefrog.net-20070702044841-bhqv1470tepruga0
Show bzr.log location in bzr --version output.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
_trace_file = None
76
76
_trace_depth = 0
77
77
_bzr_log_file = None
 
78
_bzr_log_filename = None
78
79
 
79
80
 
80
81
# configure convenient aliases for output routines
141
142
    # Messages are always written to here, so that we have some
142
143
    # information if something goes wrong.  In a future version this
143
144
    # file will be removed on successful completion.
144
 
    global _file_handler, _bzr_log_file
 
145
    global _file_handler, _bzr_log_file, _bzr_log_filename
145
146
    import codecs
146
147
 
147
148
    if tracefilename is None:
150
151
            home = win32utils.get_home_location()
151
152
        else:
152
153
            home = os.path.expanduser('~')
153
 
        tracefilename = os.path.join(home, '.bzr.log')
 
154
        _bzr_log_filename = os.path.join(home, '.bzr.log')
154
155
 
155
 
    trace_fname = os.path.expanduser(tracefilename)
156
 
    _rollover_trace_maybe(trace_fname)
 
156
    _bzr_log_filename = os.path.expanduser(_bzr_log_filename)
 
157
    _rollover_trace_maybe(_bzr_log_filename)
157
158
    try:
158
159
        LINE_BUFFERED = 1
159
160
        #tf = codecs.open(trace_fname, 'at', 'utf8', buffering=LINE_BUFFERED)
160
 
        tf = open(trace_fname, 'at', LINE_BUFFERED)
 
161
        tf = open(_bzr_log_filename, 'at', LINE_BUFFERED)
161
162
        _bzr_log_file = tf
162
163
        # tf.tell() on windows always return 0 until some writing done
163
164
        tf.write('\n')