~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-11-18 06:18:14 UTC
  • mfrom: (4634.97.5 doc-2.0)
  • Revision ID: pqm@pqm.ubuntu.com-20091118061814-695imx80olc79o7l
(mbp, trivial) additional doc building fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
import logging
60
60
import os
61
61
import sys
62
 
import re
63
62
import time
64
63
 
65
64
from bzrlib.lazy_import import lazy_import
72
71
 
73
72
import bzrlib
74
73
 
 
74
from bzrlib.symbol_versioning import (
 
75
    deprecated_function,
 
76
    deprecated_in,
 
77
    )
 
78
 
75
79
lazy_import(globals(), """
76
80
from bzrlib import (
77
81
    debug,
123
127
    _bzr_logger.warning(*args, **kwargs)
124
128
 
125
129
 
126
 
# configure convenient aliases for output routines
127
 
#
128
 
# TODO: deprecate them, have one name for each.
129
 
info = note
130
 
log_error = _bzr_logger.error
131
 
error =     _bzr_logger.error
 
130
@deprecated_function(deprecated_in((2, 1, 0)))
 
131
def info(*args, **kwargs):
 
132
    """Deprecated: use trace.note instead."""
 
133
    note(*args, **kwargs)
 
134
 
 
135
 
 
136
@deprecated_function(deprecated_in((2, 1, 0)))
 
137
def log_error(*args, **kwargs):
 
138
    """Deprecated: use bzrlib.trace.show_error instead"""
 
139
    _bzr_logger.error(*args, **kwargs)
 
140
 
 
141
 
 
142
@deprecated_function(deprecated_in((2, 1, 0)))
 
143
def error(*args, **kwargs):
 
144
    """Deprecated: use bzrlib.trace.show_error instead"""
 
145
    _bzr_logger.error(*args, **kwargs)
 
146
 
 
147
 
 
148
def show_error(msg):
 
149
    """Show an error message to the user.
 
150
 
 
151
    Don't use this for exceptions, use report_exception instead.
 
152
    """
 
153
    _bzr_logger.error(*args, **kwargs)
132
154
 
133
155
 
134
156
_last_mutter_flush_time = None
135
157
 
 
158
 
136
159
def mutter(fmt, *args):
137
160
    global _last_mutter_flush_time
138
161
    if _trace_file is None:
432
455
    elif isinstance(exc_object, KeyboardInterrupt):
433
456
        err_file.write("bzr: interrupted\n")
434
457
        return errors.EXIT_ERROR
 
458
    elif isinstance(exc_object, MemoryError):
 
459
        err_file.write("bzr: out of memory\n")
 
460
        return errors.EXIT_ERROR
435
461
    elif isinstance(exc_object, ImportError) \
436
462
        and str(exc_object).startswith("No module named "):
437
463
        report_user_error(exc_info, err_file,