140
def open_tracefile(tracefilename='~/.bzr.log'):
140
def open_tracefile(tracefilename=None):
141
141
# Messages are always written to here, so that we have some
142
142
# information if something goes wrong. In a future version this
143
143
# file will be removed on successful completion.
144
144
global _file_handler, _bzr_log_file
147
trace_fname = os.path.join(os.path.expanduser(tracefilename))
147
if tracefilename is None:
148
if sys.platform == 'win32':
149
from bzrlib import win32utils
150
home = win32utils.get_home_location()
152
home = os.path.expanduser('~')
153
tracefilename = os.path.join(home, '.bzr.log')
155
trace_fname = os.path.expanduser(tracefilename)
148
156
_rollover_trace_maybe(trace_fname)
150
158
LINE_BUFFERED = 1
151
159
#tf = codecs.open(trace_fname, 'at', 'utf8', buffering=LINE_BUFFERED)
152
160
tf = open(trace_fname, 'at', LINE_BUFFERED)
153
161
_bzr_log_file = tf
155
tf.write("\nthis is a debug log for diagnosing/reporting problems in bzr\n")
162
# tf.tell() on windows always return 0 until some writing done
165
tf.write("this is a debug log for diagnosing/reporting problems in bzr\n")
156
166
tf.write("you can delete or truncate this file, or include sections in\n")
157
167
tf.write("bug reports to bazaar@lists.canonical.com\n\n")
158
168
_file_handler = logging.StreamHandler(tf)