Changeset 6667


Ignore:
Timestamp:
Mar 31, 2009, 1:07:40 PM (15 years ago)
Author:
rwilson
Message:

Made log module run under python 2.3 and 2.4 (I hope).

File:
1 edited

Legend:

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

    r6663 r6667  
    1818Until the first call to log() the user is free to play with the module data
    1919to configure the logging.
     20
     21Note that this module uses features of the logging package that were introduced
     22in python2.5.  If running on earlier versions, these features are disables:
     23    . Module name + line number
    2024'''
    2125
     
    7579    global _setup, log_logging_level
    7680
     81    # get running python version for later
     82    (version_major, version_minor, _, _, _) = sys.version_info
     83
    7784    # have we been setup?
    7885    if not _setup:
     
    99106                        logging.getLevelName(log_logging_level),
    100107                        logging.getLevelName(console_logging_level)))
    101         logging.log(logging.CRITICAL, start_msg,
    102                     extra={'mname': __name__, 'lnum': 0})
     108        if version_major >= 2 and version_minor >= 5:
     109            logging.log(logging.CRITICAL, start_msg,
     110                        extra={'mname': __name__, 'lnum': 0})
     111        else:
     112            logging.log(logging.CRITICAL, start_msg)
    103113
    104114        # mark module as *setup*
     
    113123            break
    114124
    115     logging.log(level, msg, extra={'mname': fname, 'lnum': lnum})
     125    if version_major >= 2 and version_minor >= 5:
     126        logging.log(level, msg, extra={'mname': fname, 'lnum': lnum})
     127    else:
     128        logging.log(level, msg)
    116129
    117130################################################################################
Note: See TracChangeset for help on using the changeset viewer.