/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: Jelmer Vernooij
  • Date: 2009-02-25 14:36:59 UTC
  • mfrom: (4048 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4049.
  • Revision ID: jelmer@samba.org-20090225143659-vx6cbqtmyicuzfyf
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
216
216
 
217
217
 
218
218
def _open_bzr_log():
219
 
    """Open the .bzr.log trace file.  
 
219
    """Open the .bzr.log trace file.
220
220
 
221
221
    If the log is more than a particular length, the old file is renamed to
222
222
    .bzr.log.old and a new file is started.  Otherwise, we append to the
281
281
 
282
282
    :param to_file: A file-like object to which messages will be sent.
283
283
 
284
 
    :returns: A memento that should be passed to _pop_log_file to restore the 
 
284
    :returns: A memento that should be passed to _pop_log_file to restore the
285
285
    previously active logging.
286
286
    """
287
287
    global _trace_file
316
316
    """Undo changes to logging/tracing done by _push_log_file.
317
317
 
318
318
    This flushes, but does not close the trace file.
319
 
    
 
319
 
320
320
    Takes the memento returned from _push_log_file."""
321
321
    global _trace_file
322
322
    _trace_file = old_trace_file
332
332
@symbol_versioning.deprecated_function(symbol_versioning.one_two)
333
333
def enable_test_log(to_file):
334
334
    """Redirect logging to a temporary file for a test
335
 
    
 
335
 
336
336
    :returns: an opaque reference that should be passed to disable_test_log
337
337
    after the test completes.
338
338
    """
347
347
def log_exception_quietly():
348
348
    """Log the last exception to the trace file only.
349
349
 
350
 
    Used for exceptions that occur internally and that may be 
351
 
    interesting to developers but not to users.  For example, 
 
350
    Used for exceptions that occur internally and that may be
 
351
    interesting to developers but not to users.  For example,
352
352
    errors loading plugins.
353
353
    """
354
354
    mutter(traceback.format_exc())
407
407
    pass
408
408
 
409
409
 
410
 
_short_fields = ('VmPeak', 'VmSize', 'VmRSS')
411
 
 
412
410
def debug_memory(message='', short=True):
413
411
    """Write out a memory dump."""
 
412
    if sys.platform == 'win32':
 
413
        from bzrlib import win32utils
 
414
        win32utils.debug_memory_win32api(message=message, short=short)
 
415
    else:
 
416
        _debug_memory_proc(message=message, short=short)
 
417
 
 
418
 
 
419
_short_fields = ('VmPeak', 'VmSize', 'VmRSS')
 
420
 
 
421
def _debug_memory_proc(message='', short=True):
414
422
    try:
415
423
        status_file = file('/proc/%s/status' % os.getpid(), 'rb')
416
424
    except IOError: