~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Andrew Bennetts
  • Date: 2010-06-27 05:25:03 UTC
  • mto: This revision was merged to the branch mainline in revision 5322.
  • Revision ID: andrew.bennetts@canonical.com-20100627052503-rat7ch559a215swk
Implement __sizeof__ in StaticTuple.

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
 
112
112
 
113
113
def note(*args, **kwargs):
 
114
    """Output a note to the user.
 
115
 
 
116
    Takes the same parameters as logging.info.
 
117
 
 
118
    :return: None
 
119
    """
114
120
    # FIXME note always emits utf-8, regardless of the terminal encoding
115
121
    #
116
122
    # FIXME: clearing the ui and then going through the abstract logging
368
374
    _trace_file = old_trace_file
369
375
    bzr_logger = logging.getLogger('bzr')
370
376
    bzr_logger.removeHandler(new_handler)
371
 
    # must be closed, otherwise logging will try to close it atexit, and the
 
377
    # must be closed, otherwise logging will try to close it at exit, and the
372
378
    # file will likely already be closed underneath.
373
379
    new_handler.close()
374
380
    bzr_logger.handlers = old_handlers
492
498
    elif not getattr(exc_object, 'internal_error', True):
493
499
        report_user_error(exc_info, err_file)
494
500
        return errors.EXIT_ERROR
495
 
    elif isinstance(exc_object, (OSError, IOError)):
 
501
    elif isinstance(exc_object, (OSError, IOError)) or (
 
502
        # GZ 2010-05-20: Like (exc_type is pywintypes.error) but avoid import
 
503
        exc_type.__name__ == "error" and exc_type.__module__ == "pywintypes"):
496
504
        # Might be nice to catch all of these and show them as something more
497
505
        # specific, but there are too many cases at the moment.
498
506
        report_user_error(exc_info, err_file)
532
540
 
533
541
 
534
542
def _flush_stdout_stderr():
535
 
    # installed into an atexit hook by bzrlib.initialize()
 
543
    # called from the bzrlib library finalizer returned by bzrlib.initialize()
536
544
    try:
537
545
        sys.stdout.flush()
538
546
        sys.stderr.flush()
545
553
 
546
554
 
547
555
def _flush_trace():
548
 
    # run from atexit hook
 
556
    # called from the bzrlib library finalizer returned by bzrlib.initialize()
549
557
    global _trace_file
550
558
    if _trace_file:
551
559
        _trace_file.flush()