~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: John Arbash Meinel
  • Date: 2006-12-01 19:41:16 UTC
  • mfrom: (2158 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2159.
  • Revision ID: john@arbash-meinel.com-20061201194116-nvn5qhfxux5284jc
[merge] bzr.dev 2158

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        zero_nine,
66
66
        )
67
67
 
 
68
lazy_import(globals(), """
 
69
from bzrlib import debug
 
70
""")
 
71
 
68
72
_file_handler = None
69
73
_stderr_handler = None
70
74
_stderr_quiet = False
118
122
    _trace_file.write(out)
119
123
    # TODO: jam 20051227 Consider flushing the trace file to help debugging
120
124
    #_trace_file.flush()
121
 
debug = mutter
122
125
 
123
126
 
124
127
def _rollover_trace_maybe(trace_fname):
182
185
    errors loading plugins.
183
186
    """
184
187
    import traceback
185
 
    debug(traceback.format_exc())
 
188
    mutter(traceback.format_exc())
186
189
 
187
190
 
188
191
def enable_default_logging():
269
272
        print >>err_file, "bzr: broken pipe"
270
273
    elif isinstance(exc_object, KeyboardInterrupt):
271
274
        print >>err_file, "bzr: interrupted"
272
 
    elif getattr(exc_object, 'is_user_error', False):
 
275
    elif not getattr(exc_object, 'internal_error', True):
273
276
        report_user_error(exc_info, err_file)
274
277
    elif isinstance(exc_object, (OSError, IOError)):
275
278
        # Might be nice to catch all of these and show them as something more
281
284
 
282
285
# TODO: Should these be specially encoding the output?
283
286
def report_user_error(exc_info, err_file):
 
287
    """Report to err_file an error that's not an internal error.
 
288
 
 
289
    These don't get a traceback unless -Derror was given.
 
290
    """
 
291
    if 'error' in debug.debug_flags:
 
292
        report_bug(exc_info, err_file)
 
293
        return
284
294
    print >>err_file, "bzr: ERROR:", str(exc_info[1])
285
295
 
286
296