~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Robert Collins
  • Date: 2010-06-28 02:41:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5324.
  • Revision ID: robertc@robertcollins.net-20100628024122-g951fzp74f3u6wst
Sanity check that new_trace_file in pop_log_file is valid, and also fix a test that monkey patched get_terminal_encoding.

Show diffs side-by-side

added added

removed removed

Lines of Context:
368
368
def pop_log_file((magic, old_handlers, new_handler, old_trace_file, new_trace_file)):
369
369
    """Undo changes to logging/tracing done by _push_log_file.
370
370
 
371
 
    This flushes, but does not close the trace file.
 
371
    This flushes, but does not close the trace file (so that anything that was
 
372
    in it is output.
372
373
 
373
374
    Takes the memento returned from _push_log_file."""
374
375
    global _trace_file
379
380
    # file will likely already be closed underneath.
380
381
    new_handler.close()
381
382
    bzr_logger.handlers = old_handlers
382
 
    new_trace_file.flush()
 
383
    if new_trace_file is not None:
 
384
        new_trace_file.flush()
383
385
 
384
386
 
385
387
def log_exception_quietly():