~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Martin Pool
  • Date: 2005-11-11 23:24:50 UTC
  • mto: (1185.33.43 bzr.dev)
  • mto: This revision was merged to the branch mainline in revision 1512.
  • Revision ID: mbp@sourcefrog.net-20051111232450-aec10ff8afa12bae
Make logging of errors go through our trace functions

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
    The exception string representation is used as the error
173
173
    summary, unless msg is given.
174
174
    """
175
 
    exc_str = format_exception_short(sys.exc_info())
176
175
    if msg:
177
 
        _bzr_logger.exception(msg)
178
 
    _bzr_logger.error(exc_str)
 
176
        error(msg)
 
177
    else:
 
178
        exc_str = format_exception_short(sys.exc_info())
 
179
        error(exc_str)
 
180
    log_exception_quietly()
179
181
 
180
182
 
181
183
def log_exception_quietly():
191
193
 
192
194
def enable_default_logging():
193
195
    """Configure default logging to stderr and .bzr.log"""
 
196
    # FIXME: if this is run twice, things get confused
194
197
    global _stderr_handler, _file_handler, _trace_file, _bzr_log_file
195
198
    _stderr_handler = logging.StreamHandler()
196
199
    _stderr_handler.setFormatter(QuietFormatter())