~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: James Westby
  • Date: 2008-05-15 16:35:39 UTC
  • mto: This revision was merged to the branch mainline in revision 3435.
  • Revision ID: jw+debian@jameswestby.net-20080515163539-820fx3349404nq7i
Allow -Derror to show exceptions caused by plugin import errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
321
321
    return pop_log_file(memento)
322
322
 
323
323
 
324
 
def log_exception_quietly():
 
324
def log_exception_quietly(allow_debug=True):
325
325
    """Log the last exception to the trace file only.
326
326
 
327
327
    Used for exceptions that occur internally and that may be 
328
328
    interesting to developers but not to users.  For example, 
329
329
    errors loading plugins.
330
330
    """
331
 
    mutter(traceback.format_exc())
 
331
    exception_message = traceback.format_exc()
 
332
    mutter(exception_message)
 
333
    if 'error' in debug.debug_flags and allow_debug:
 
334
        sys.stderr.write(exception_message)
332
335
 
333
336
 
334
337
def set_verbosity_level(level):
393
396
    """
394
397
    exc_type, exc_object, exc_tb = exc_info
395
398
    # Log the full traceback to ~/.bzr.log
396
 
    log_exception_quietly()
 
399
    log_exception_quietly(allow_debug=False)
397
400
    if (isinstance(exc_object, IOError)
398
401
        and getattr(exc_object, 'errno', None) == errno.EPIPE):
399
402
        err_file.write("bzr: broken pipe\n")