Changeset 6888


Ignore:
Timestamp:
Apr 23, 2009, 4:47:07 PM (16 years ago)
Author:
rwilson
Message:

Back-ported changes in logging.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/utilities/log.py

    r6668 r6888  
    2020
    2121Note that this module uses features of the logging package that were introduced
    22 in python2.5.  If running on earlier versions, these features are disables:
    23     . Module name + line number
     22in python2.5.  If running on earlier versions, these features are disabled:
     23    . Calling module name + line number
    2424'''
    2525
     
    8585    if not _setup:
    8686        # sanity check the logging levels, require console >= file
    87         if console_logging_level < log_logging_level:
     87        if log_logging_level > console_logging_level:
    8888            log_logging_level = console_logging_level
    8989
     
    121121    frames = traceback.extract_stack()
    122122    frames.reverse()
     123    (_, mod_name) = __name__.rsplit('.', 1)
    123124    for (fpath, lnum, mname, _) in frames:
    124         fname = os.path.basename(mname).rsplit('.', 1)[0]
    125         if mname != __name__:
     125        (fname, _) = os.path.basename(fpath).rsplit('.', 1)
     126        if fname != mod_name:
    126127            break
    127128
     
    165166    log(logging.CRITICAL, msg)
    166167
    167 def resource_usage(level=logging.CRITICAL):
    168     '''Log resource usage at given log level.'''
     168##
     169# @brief Log memory usage at time of call.
     170# @param level Override the default INFO logging level.
     171# @note From http://code.activestate.com/recipes/286222/.
     172def resource_usage(level=logging.INFO):
     173    '''Log memory usage at given log level.'''
    169174
    170175    if sys.platform != 'win32':
  • branches/numpy/anuga/utilities/log.py

    r6833 r6888  
    1818Until the first call to log() the user is free to play with the module data
    1919to configure the logging.
     20
    2021Note that this module uses features of the logging package that were introduced
    2122in python2.5.  If running on earlier versions, these features are disabled:
Note: See TracChangeset for help on using the changeset viewer.