/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Vincent Ladeuil
  • Date: 2011-07-06 09:22:00 UTC
  • mfrom: (6008 +trunk)
  • mto: (6012.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6013.
  • Revision ID: v.ladeuil+lp@free.fr-20110706092200-7iai2mwzc0sqdsvf
MergingĀ inĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
59
59
import os
60
60
import sys
61
61
import time
62
 
import tempfile
63
62
 
64
63
from bzrlib.lazy_import import lazy_import
65
64
lazy_import(globals(), """
66
65
from cStringIO import StringIO
67
66
import errno
68
67
import locale
 
68
import tempfile
69
69
import traceback
70
70
""")
71
71
 
81
81
    debug,
82
82
    errors,
83
83
    osutils,
84
 
    plugin,
85
 
    symbol_versioning,
86
84
    ui,
87
85
    )
88
86
""")
334
332
    :param to_file: A file-like object to which messages will be sent.
335
333
 
336
334
    :returns: A memento that should be passed to _pop_log_file to restore the
337
 
    previously active logging.
 
335
        previously active logging.
338
336
    """
339
337
    global _trace_file
340
338
    # make a new handler
488
486
        elif fd is not None:
489
487
            os.close(fd)
490
488
 
 
489
 
 
490
def _qualified_exception_name(eclass, unqualified_bzrlib_errors=False):
 
491
    """Give name of error class including module for non-builtin exceptions
 
492
 
 
493
    If `unqualified_bzrlib_errors` is True, errors specific to bzrlib will
 
494
    also omit the module prefix.
 
495
    """
 
496
    class_name = eclass.__name__
 
497
    module_name = eclass.__module__
 
498
    if module_name in ("exceptions", "__main__") or (
 
499
            unqualified_bzrlib_errors and module_name == "bzrlib.errors"):
 
500
        return class_name
 
501
    return "%s.%s" % (module_name, class_name)
 
502
 
 
503
 
491
504
def report_exception(exc_info, err_file):
492
505
    """Report an exception to err_file (typically stderr) and to .bzr.log.
493
506