Index: branches/numpy/anuga/utilities/log.py
===================================================================
--- branches/numpy/anuga/utilities/log.py	(revision 7095)
+++ branches/numpy/anuga/utilities/log.py	(revision 7140)
@@ -36,4 +36,7 @@
 import traceback
 import logging
+
+DefaultConsoleLogLevel = logging.CRITICAL
+DefaultFileLogLevel = logging.INFO
 
 
@@ -45,4 +48,7 @@
 # the console, but ensure that everything that goes to the console *will* also
 # appear in the log file.  There is code to ensure log <= console levels.
+#
+# If console logging level is set to CRITICAL+1 then nothing will print on the
+# console.
 ################################################################################
 
@@ -51,8 +57,8 @@
 
 # logging level for the console
-console_logging_level = logging.CRITICAL
+console_logging_level = DefaultConsoleLogLevel
 
 # logging level for the logfile
-log_logging_level = logging.INFO
+log_logging_level = DefaultFileLogLevel
 
 # The default name of the file to log to.
@@ -75,11 +81,9 @@
 ################################################################################
 
-##
-# @brief Log a message at a specified level.
-# @param level The loglevel to log with (logging.DEBUG, etc).
-# @param msg Message string to log.
-# @note First call of this method initializes the logging system.
-def log(level, msg):
+def log(msg, level=None):
     '''Log a message at a particular loglevel.
+
+    msg:    The message string to log.
+    level:  The logging level to log with (defaults to console level).
 
     The first call to this method (by anybody) initializes logging and
@@ -128,4 +132,8 @@
         _setup = True
 
+    # if logging level not supplied, assume console level
+    if level is None:
+        level = console_logging_level
+
     # get caller information - look back for first module != <this module name>
     frames = traceback.extract_stack()
@@ -146,11 +154,15 @@
         logging.log(level, msg)
 
-##
-# @brief Hook function to process uncaught exceptions.
-# @param type Type of exception.
-# @param value Exception data.
-# @param traceback Traceback object.
-# @note Same interface as sys.excepthook()
+
 def log_exception_hook(type, value, tb):
+    '''Hook function to process uncaught exceptions.
+
+    type:   Type of exception.
+    value:  The exception data.
+    tb:     Traceback object.
+
+    This has the same interface as sys.excepthook().
+    '''
+
     msg = '\n' + ''.join(traceback.format_exception(type, value, tb))
     critical(msg)
@@ -161,38 +173,34 @@
 ################################################################################
 
-##
-# @brief Shortcut for log(DEBUG, msg).
-# @param msg Message string to log at logging.DEBUG level.
 def debug(msg=''):
-    log(logging.DEBUG, msg)
-
-##
-# @brief Shortcut for log(INFO, msg).
-# @param msg Message string to log at logging.INFO level.
+    '''Shortcut for log(DEBUG, msg).'''
+
+    log(msg, logging.DEBUG)
+
+
 def info(msg=''):
-    log(logging.INFO, msg)
-
-##
-# @brief Shortcut for log(WARNING, msg).
-# @param msg Message string to log at logging.WARNING level.
+    '''Shortcut for log(INFO, msg).'''
+
+    log(msg, logging.INFO)
+
+
 def warning(msg=''):
-    log(logging.WARNING, msg)
-
-##
-# @brief Shortcut for log(ERROR, msg).
-# @param msg Message string to log at logging.ERROR level.
+    '''Shortcut for log(WARNING, msg).'''
+
+    log(msg, logging.WARNING)
+
+
 def error(msg=''):
-    log(logging.ERROR, msg)
-
-##
-# @brief Shortcut for log(CRITICAL, msg).
-# @param msg Message string to log at logging.CRITICAL level.
+    '''Shortcut for log(ERROR, msg).'''
+
+    log(msg, logging.ERROR)
+
+
 def critical(msg=''):
-    log(logging.CRITICAL, msg)
-
-##
-# @brief Log memory usage at time of call.
-# @param level Override the default INFO logging level.
-# @note From http://code.activestate.com/recipes/286222/.
+    '''Shortcut for log(CRITICAL, msg).'''
+
+    log(msg, logging.CRITICAL)
+
+
 def resource_usage(level=logging.INFO):
     '''Log memory usage at given log level.'''
@@ -242,5 +250,5 @@
                % (memory()/_scale['MB'], resident()/_scale['MB'],
                   stacksize()/_scale['MB']))
-        log(level, msg)
+        log(msg, level)
     else:
         # Windows code from: http://code.activestate.com/recipes/511491/
@@ -274,10 +282,18 @@
                % (memoryStatusEx.ullTotalPhys/_scale['MB'],
                   memoryStatusEx.ullAvailPhys/_scale['MB']))
-        log(level, msg)
-
+        log(msg, level)
+
+
+################################################################################
 
 if __name__ == '__main__':
     critical('#' * 80)
     warning('Test of logging...')
+    log('CRITICAL+1', CRITICAL+1)
+    log('CRITICAL', CRITICAL)
+    log('CRITICAL-1', CRITICAL-1)
+    log('CRITICAL-2', CRITICAL-2)
+    log('default - CRITICAL?')
+
     def test_it(num=100):
         if num > 0:
