/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: Martin Pool
  • Date: 2008-01-22 07:42:30 UTC
  • mto: This revision was merged to the branch mainline in revision 3219.
  • Revision ID: mbp@sourcefrog.net-20080122074230-87ijmlmu1jrwer3a
Rename push/pop_log_file, and deprecate enable/disable_test_log

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
 
109
109
def note(*args, **kwargs):
110
110
    # FIXME note always emits utf-8, regardless of the terminal encoding
 
111
    #
 
112
    # FIXME: clearing the ui and then going through the abstract logging
 
113
    # framework is whack; we should probably have a logging Handler that
 
114
    # deals with terminal output if needed.
111
115
    import bzrlib.ui
112
116
    bzrlib.ui.ui_factory.clear_term()
113
117
    _bzr_logger.info(*args, **kwargs)
250
254
    logging.getLogger('bzr').addHandler(stderr_handler)
251
255
 
252
256
 
253
 
def _push_log_file(to_file, log_format=None, date_format=None):
 
257
def push_log_file(to_file, log_format=None, date_format=None):
254
258
    """Intercept log and trace messages and send them to a file.
255
259
 
256
260
    :returns: A memento that should be passed to _pop_log_file to restore the 
284
288
    return ('log_memento', old_handlers, new_handler, old_trace_file, to_file)
285
289
 
286
290
 
287
 
def _pop_log_file((magic, old_handlers, new_handler, old_trace_file, new_trace_file)):
 
291
def pop_log_file((magic, old_handlers, new_handler, old_trace_file, new_trace_file)):
288
292
    """Undo changes to logging/tracing done by _push_log_file.
289
293
 
290
294
    This flushes, but does not close the trace file.
302
306
    new_trace_file.flush()
303
307
 
304
308
 
 
309
@symbol_versioning.deprecated_function(symbol_versioning.one_two)
305
310
def enable_test_log(to_file):
306
311
    """Redirect logging to a temporary file for a test
307
312
    
308
313
    :returns: an opaque reference that should be passed to disable_test_log
309
314
    after the test completes.
310
315
    """
311
 
    return _push_log_file(to_file)
312
 
 
313
 
 
 
316
    return push_log_file(to_file)
 
317
 
 
318
 
 
319
@symbol_versioning.deprecated_function(symbol_versioning.one_two)
314
320
def disable_test_log(memento):
315
 
    return _pop_log_file(memento)
 
321
    return pop_log_file(memento)
316
322
 
317
323
 
318
324
def log_exception_quietly():