~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

Add a NEWS entry and prepare submission.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
"""Messages and logging.
 
17
"""Messages and logging for bazaar-ng.
18
18
 
19
19
Messages are supplied by callers as a string-formatting template, plus values
20
20
to be inserted into it.  The actual %-formatting is deferred to the log
33
33
 
34
34
Output to stderr depends on the mode chosen by the user.  By default, messages
35
35
of info and above are sent out, which results in progress messages such as the
36
 
list of files processed by add and commit.  In debug mode, stderr gets debug messages too.
 
36
list of files processed by add and commit.  In quiet mode, only warnings and
 
37
above are shown.  In debug mode, stderr gets debug messages too.
37
38
 
38
39
Errors that terminate an operation are generally passed back as exceptions;
39
40
others may be just emitted as messages.
82
83
    osutils,
83
84
    plugin,
84
85
    symbol_versioning,
85
 
    ui,
86
86
    )
87
87
""")
88
88
 
250
250
            bzr_log_file.write("bug reports to https://bugs.launchpad.net/bzr/+filebug\n\n")
251
251
        return bzr_log_file
252
252
    except IOError, e:
253
 
        # If we are failing to open the log, then most likely logging has not
254
 
        # been set up yet. So we just write to stderr rather than using
255
 
        # 'warning()'. If we using warning(), users get the unhelpful 'no
256
 
        # handlers registered for "bzr"' when something goes wrong on the
257
 
        # server. (bug #503886)
258
 
        sys.stderr.write("failed to open trace file: %s\n" % (e,))
 
253
        warning("failed to open trace file: %s" % (e))
259
254
    # TODO: What should happen if we fail to open the trace file?  Maybe the
260
255
    # objects should be pointed at /dev/null or the equivalent?  Currently
261
256
    # returns None which will cause failures later.
365
360
    global _verbosity_level
366
361
    _verbosity_level = level
367
362
    _update_logging_level(level < 0)
368
 
    ui.ui_factory.be_quiet(level < 0)
369
363
 
370
364
 
371
365
def get_verbosity_level():
377
371
 
378
372
 
379
373
def be_quiet(quiet=True):
 
374
    # Perhaps this could be deprecated now ...
380
375
    if quiet:
381
376
        set_verbosity_level(-1)
382
377
    else: