~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Alexander Belchenko
  • Date: 2007-11-19 22:54:30 UTC
  • mfrom: (3006 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3008.
  • Revision ID: bialix@ukr.net-20071119225430-x0ewosrsagis0yno
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
# is quite expensive, even when the message is not printed by any handlers.
51
51
# We should perhaps change back to just simply doing it here.
52
52
 
 
53
import codecs
 
54
import logging
53
55
import os
54
56
import sys
55
57
import re
59
61
from cStringIO import StringIO
60
62
import errno
61
63
import locale
62
 
import logging
63
64
import traceback
64
65
""")
65
66
 
87
88
 
88
89
_bzr_logger = logging.getLogger('bzr')
89
90
 
 
91
 
90
92
def note(*args, **kwargs):
91
93
    # FIXME note always emits utf-8, regardless of the terminal encoding
92
94
    import bzrlib.ui
212
214
    """Configure default logging to stderr and .bzr.log"""
213
215
    # FIXME: if this is run twice, things get confused
214
216
    global _stderr_handler, _file_handler, _trace_file, _bzr_log_file
215
 
    _stderr_handler = logging.StreamHandler()
 
217
    # create encoded wrapper around stderr
 
218
    stderr = codecs.getwriter(osutils.get_terminal_encoding())(sys.stderr,
 
219
        errors='replace')
 
220
    _stderr_handler = logging.StreamHandler(stderr)
216
221
    logging.getLogger('').addHandler(_stderr_handler)
217
222
    _stderr_handler.setLevel(logging.INFO)
218
223
    if not _file_handler: