~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

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
 
 
54
 
import errno
55
53
import os
56
54
import sys
 
55
import re
 
56
 
 
57
from bzrlib.lazy_import import lazy_import
 
58
lazy_import(globals(), """
 
59
import errno
57
60
import logging
 
61
""")
58
62
 
59
63
import bzrlib
60
 
from bzrlib.errors import BzrError, BzrNewError
61
64
from bzrlib.symbol_versioning import (deprecated_function,
62
65
        zero_nine,
63
66
        )
93
96
def mutter(fmt, *args):
94
97
    if _trace_file is None:
95
98
        return
96
 
    if hasattr(_trace_file, 'closed') and _trace_file.closed:
 
99
    if (getattr(_trace_file, 'closed', None) is not None) and _trace_file.closed:
97
100
        return
98
101
 
99
102
    if isinstance(fmt, unicode):
168
171
    """
169
172
    if msg:
170
173
        error(msg)
171
 
    else:
172
 
        exc_str = format_exception_short(sys.exc_info())
173
 
        error(exc_str)
174
174
    log_exception_quietly()
175
175
 
176
176
 
288
288
    """Report an exception that probably indicates a bug in bzr"""
289
289
    import traceback
290
290
    exc_type, exc_object, exc_tb = exc_info
291
 
    print >>err_file, "bzr: ERROR: %s: %s" % (exc_type, exc_object)
 
291
    print >>err_file, "bzr: ERROR: %s.%s: %s" % (
 
292
        exc_type.__module__, exc_type.__name__, exc_object)
292
293
    print >>err_file
293
294
    traceback.print_exception(exc_type, exc_object, exc_tb, file=err_file)
294
295
    print >>err_file