~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Martin Pool
  • Date: 2006-06-20 01:35:25 UTC
  • mto: This revision was merged to the branch mainline in revision 1797.
  • Revision ID: mbp@sourcefrog.net-20060620013525-d2eba83a7c6e953b
Review cleanups: better error reporting, put back report_exception. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
import bzrlib
60
60
from bzrlib.errors import BzrError, BzrNewError
61
 
 
 
61
from bzrlib.symbol_versioning import (deprecated_function,
 
62
        zero_nine,
 
63
        )
62
64
 
63
65
_file_handler = None
64
66
_stderr_handler = None
141
143
        warning("failed to open trace file: %s" % (e))
142
144
 
143
145
 
 
146
@deprecated_function(zero_nine)
 
147
def log_exception(msg=None):
 
148
    """Log the last exception to stderr and the trace file.
 
149
 
 
150
    The exception string representation is used as the error
 
151
    summary, unless msg is given.
 
152
    """
 
153
    if msg:
 
154
        error(msg)
 
155
    else:
 
156
        exc_str = format_exception_short(sys.exc_info())
 
157
        error(exc_str)
 
158
    log_exception_quietly()
 
159
 
 
160
 
144
161
def log_exception_quietly():
145
162
    """Log the last exception to the trace file only.
146
163