/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: Robert Collins
  • Date: 2010-06-25 20:34:05 UTC
  • mto: This revision was merged to the branch mainline in revision 5324.
  • Revision ID: robertc@robertcollins.net-20100625203405-c74lxd3enklhaqf9
``bzrlib.osutils.get_terminal_encoding`` will now only mutter its
selection when explicitly requested; this avoids many duplicate calls
being logged when helpers, wrappers and older code that manually calls
it are executed it is now logged deliberately by the ui setup code.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
307
307
 
308
308
    Output can be redirected away by calling _push_log_file.
309
309
    """
310
 
    # Do this before we open the log file, so we prevent
311
 
    # get_terminal_encoding() from mutter()ing multiple times
312
 
    term_encoding = osutils.get_terminal_encoding()
313
310
    start_time = osutils.format_local_date(_bzr_log_start_time,
314
311
                                           timezone='local')
315
312
    # create encoded wrapper around stderr
321
318
        r'%Y-%m-%d %H:%M:%S')
322
319
    # after hooking output into bzr_log, we also need to attach a stderr
323
320
    # handler, writing only at level info and with encoding
 
321
    term_encoding = osutils.get_terminal_encoding()
324
322
    writer_factory = codecs.getwriter(term_encoding)
325
323
    encoded_stderr = writer_factory(sys.stderr, errors='replace')
326
324
    stderr_handler = logging.StreamHandler(encoded_stderr)