- Timestamp:
- Apr 2, 2009, 4:04:16 PM (16 years ago)
- Location:
- branches/numpy/anuga/utilities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/numpy/anuga/utilities/log.py
r6689 r6702 19 19 to configure the logging. 20 20 Note that this module uses features of the logging package that were introduced 21 in python2.5. If running on earlier versions, these features are disable s:22 . Module name + line number21 in python2.5. If running on earlier versions, these features are disabled: 22 . Calling module name + line number 23 23 ''' 24 24 … … 84 84 if not _setup: 85 85 # sanity check the logging levels, require console >= file 86 if console_logging_level < log_logging_level:86 if log_logging_level > console_logging_level: 87 87 log_logging_level = console_logging_level 88 88 … … 122 122 for (fpath, lnum, mname, _) in frames: 123 123 fname = os.path.basename(mname).rsplit('.', 1)[0] 124 print 'fname=%s, mname=%s' % (fname, mname) 124 125 if mname != __name__: 125 126 break … … 164 165 log(logging.CRITICAL, msg) 165 166 166 def resource_usage(level=logging.CRITICAL): 167 '''Log resource usage at given log level.''' 167 ## 168 # @brief Log memory usage at time of call. 169 # @param level Override the default INFO logging level. 170 # @note From http://code.activestate.com/recipes/286222/. 171 def resource_usage(level=logging.INFO): 172 '''Log memory usage at given log level.''' 168 173 169 174 if sys.platform != 'win32': … … 213 218 else: 214 219 pass 220 221 if __name__ == "__main__": 222 debug('DEBUG message') 223 info('INFO message') 224 warning('WARNING message') -
branches/numpy/anuga/utilities/log_test.py
r6697 r6702 27 27 28 28 def tearDown(self): 29 if os.path.exists(LOGFILE_NAME): 30 os.remove(LOGFILE_NAME) 31 if os.path.exists(STDOUT_LOG_NAME): 32 os.remove(STDOUT_LOG_NAME) 29 pass 30 # if os.path.exists(LOGFILE_NAME): 31 # os.remove(LOGFILE_NAME) 32 # if os.path.exists(STDOUT_LOG_NAME): 33 # os.remove(STDOUT_LOG_NAME) 33 34 34 35 ##
Note: See TracChangeset
for help on using the changeset viewer.