Index: /trunk/psLib/src/sys/psLogMsg.c
===================================================================
--- /trunk/psLib/src/sys/psLogMsg.c	(revision 1012)
+++ /trunk/psLib/src/sys/psLogMsg.c	(revision 1013)
@@ -1,13 +1,29 @@
-/*****************************************************************************
-    A simple implementation of a logging facility for Pan-STARRS
- 
+/** @file  psLogMsg.c
+ *  @brief Procedures for logging messages.
+ *  \ingroup LogTrace
+ *
+ *  This file will hold the prototypes for defining procedure which set
+ *  message log levels, messahe log formats, message log destinations, and
+ *  for generating the messages themselves.
+ *  @ingroup LogTrace
+ *
+ *  @author Robert Lupton, Princeton University
+ *  @author George Gusciora, MHPCC
+ *
+ *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-12 05:50:01 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+
+/*****************************************************************************
 NOTES: currently, the prototype code has the following global variables:
-    static int logDest;
-    static int logLevel;
-    static int log_time;
-    static int log_host;
-    static int log_level;
-    static int log_name;
-    static int log_msg;
+    static int p_psGlobalLogDest;
+    static int p_psGlobalLogLevel;
+    static int p_psLogTime;
+    static int p_psLogHost;
+    static int p_psLogLevel;
+    static int p_psLogName;
+    static int p_psLogMsg;
  *****************************************************************************/
 #include <limits.h>
@@ -18,6 +34,4 @@
 #include <time.h>
 #include <unistd.h>
-
-/* #include "psLib.h" */
 #include "psLogMsg.h"
 #include "psError.h"
@@ -27,15 +41,15 @@
 #define MIN_LOG_LEVEL 0
 #define MAX_LOG_LEVEL 9
-static int logDest = PS_LOG_TO_STDERR; // where to log messages
-static int logLevel = PS_LOG_INFO;     // log all messages at this or above
+static int p_psGlobalLogDest = PS_LOG_TO_STDERR; // where to log messages
+static int p_psGlobalLogLevel = PS_LOG_INFO;     // log all messages at this or above
 //static FILE *p_logFP = NULL;
 // The following variables control
 // which information is displayed in
 // log messages.
-static int log_time = 1;                // Flag to include time info
-static int log_host = 1;                // Flag to include host info
-static int log_level = 1;               // Flag to include level info
-static int log_name = 1;                // Flag to include name info
-static int log_msg = 1;                 // Flag to include message info
+static int p_psLogTime = 1;                // Flag to include time info
+static int p_psLogHost = 1;                // Flag to include host info
+static int p_psLogLevel = 1;               // Flag to include level info
+static int p_psLogName = 1;                // Flag to include name info
+static int p_psLogMsg = 1;                 // Flag to include message info
 /*****************************************************************************
 psLogSetLevel(): Set the current log level and return old level.
@@ -49,5 +63,6 @@
 int psLogSetLevel(int level)
 {
-    int oldLevel = logLevel;
+    // Save old global log level for changing it.
+    int oldLevel = p_psGlobalLogLevel;
 
     if ((level < MIN_LOG_LEVEL) || (level > MAX_LOG_LEVEL)) {
@@ -57,5 +72,8 @@
     }
 
-    logLevel = level;
+    // Set new global log level
+    p_psGlobalLogLevel = level;
+
+    // Return old global log level
     return oldLevel;
 }
@@ -75,5 +93,6 @@
 int psLogSetDestination(int dest)
 {
-    int old = logDest;
+    // Save old global log destination before changing it.
+    int old = p_psGlobalLogDest;
 
     switch (dest) {
@@ -81,13 +100,15 @@
     case PS_LOG_TO_STDOUT:
     case PS_LOG_TO_STDERR:
-        logDest = dest;
+        // Set new global log destination
+        p_psGlobalLogDest = dest;
         break;
 
     default:
         // GUS: Should you log this error properly?
-        fprintf(stderr,"Unknown logDestination: %d (ignored)\n", dest);
-        break;
-    }
-
+        fprintf(stderr,"Unknown p_psGlobalLogDest: %d (ignored)\n", dest);
+        break;
+    }
+
+    // Return old global log destination
     return old;
 }
@@ -112,9 +133,7 @@
 void psLogSetFormat(const char *fmt)
 {
-    int nlog_time = 0;
-    int nlog_host = 0;
-    int nlog_level = 0;
-    int nlog_name = 0;
-    int nlog_msg = 0;
+
+    // Step through each character in the format string.  For each letter
+    // in that string, set/unset the appropriate logging.
 
     for (const char *ptr = fmt; *ptr != '\0'; ptr++) {
@@ -122,26 +141,23 @@
         case 'H':
         case 'h':
-            nlog_host = 1;
+            p_psLogHost = 1;
             break;
         case 'L':
         case 'l':
-            nlog_level = 1;
+            p_psLogLevel = 1;
             break;
         case 'M':
         case 'm':
-            nlog_msg = 1;
+            p_psLogMsg = 1;
             break;
         case 'N':
         case 'n':
-            nlog_name = 1;
+            p_psLogName = 1;
             break;
         case 'T':
         case 't':
-            nlog_time = 1;
+            p_psLogTime = 1;
             break;
         default:
-            // GUS: figure out the psError() format:
-            //     psError(__func__, PS_ERR_UNKNOWN, 1,
-            //            "Unknown logging keyword %c", *ptr);
             psError(__func__, "Unknown logging keyword %c", *ptr);
             break;
@@ -149,15 +165,9 @@
     }
 
-    if (!nlog_msg) {
+    if (!p_psLogMsg) {
         psTrace("utils.logMsg", 1,
                 "You must at least log error messages (You chose \"%s\")",
                 fmt);
     }
-
-    log_host = nlog_host;
-    log_level = nlog_level;
-    log_msg = nlog_msg;
-    log_name = nlog_name;
-    log_time = nlog_time;
 }
 
@@ -186,16 +196,19 @@
                va_list ap)
 {
-    static int first = 1;
+    static int first = 1;               // Flag for calling gethostname()
     static char hostname[HOST_NAME_MAX + 1];
+    // Buffer for hostname.
     char clevel=0;                      // letter-name for level
     char head[HOST_NAME_MAX + 40];      // yes, this is long enough
     char *head_ptr = head;              // where we've got to in head
-    time_t clock = time(NULL);
-    struct tm *utc = gmtime(&clock);
-
-    if ((level > logLevel) || (logDest == PS_LOG_NONE)) {
+    time_t clock = time(NULL);          // The current time.
+    struct tm *utc = gmtime(&clock);    // The current gm time.
+
+    // If logging is off, or if the level is too high, return immediately.
+    if ((level > p_psGlobalLogLevel) || (p_psGlobalLogDest == PS_LOG_NONE)) {
         return;
     }
 
+    // If I have not been here yet, determine my hostname and save it.
     if (first) {
         first = 0;
@@ -236,6 +249,6 @@
     }
 
-
-    if (log_time) {
+    // Create the various log fields...
+    if (p_psLogTime) {
         sprintf(head_ptr, "%4d:%02d:%02d %02d:%02d:%02dZ",
                 utc->tm_year + 1900, utc->tm_mon + 1, utc->tm_mday,
@@ -243,5 +256,6 @@
         head_ptr += strlen(head_ptr);
     }
-    if (log_host) {
+    // Hostname should be 20 characters.
+    if (p_psLogHost) {
         if (head_ptr > head) {
             *head_ptr++ = '|';
@@ -250,5 +264,5 @@
         head_ptr += strlen(head_ptr);
     }
-    if (log_level) {
+    if (p_psLogLevel) {
         if (head_ptr > head) {
             *head_ptr++ = '|';
@@ -257,9 +271,10 @@
         head_ptr += strlen(head_ptr);
     }
-    if (log_name) {
+    // The name field must be 15 characters.
+    if (p_psLogName) {
         if (head_ptr > head) {
             *head_ptr++ = '|';
         }
-        sprintf(head_ptr, "%-15s", name);
+        sprintf(head_ptr, "%15.15s", name);
         head_ptr += strlen(head_ptr);
     }
@@ -270,8 +285,8 @@
     *head_ptr = '\0';
 
-    switch (logDest) {
+    switch (p_psGlobalLogDest) {
     case PS_LOG_TO_STDOUT:
         puts(head);
-        if (log_msg) {
+        if (p_psLogMsg) {
             vprintf(fmt, ap);
             if (fmt[strlen(fmt) - 1] != '\n') {
@@ -285,5 +300,5 @@
     case PS_LOG_TO_STDERR:
         fputs(head, stderr);
-        if (log_msg) {
+        if (p_psLogMsg) {
             vfprintf(stderr, fmt, ap);
             if (fmt[strlen(fmt) - 1] != '\n') {
Index: /trunk/psLib/src/sys/psLogMsg.h
===================================================================
--- /trunk/psLib/src/sys/psLogMsg.h	(revision 1012)
+++ /trunk/psLib/src/sys/psLogMsg.h	(revision 1013)
@@ -1,10 +1,21 @@
+/** @file  psLogMsg.h
+ *  @brief Procedures for logging messages.
+ *  \ingroup LogTrace
+ *
+ *  This file will hold the prototypes for defining procedure which set
+ *  message log levels, messahe log formats, message log destinations, and
+ *  for generating the messages themselves.
+ *  @ingroup LogTrace
+ *
+ *  @author Robert Lupton, Princeton University
+ *  @author George Gusciora, MHPCC
+ *
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-12 05:50:01 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
 #if !defined(PS_LOG_MSG_H)
 #define PS_LOG_MSG_H
-
-/** \file psLogMsg.h
- *  \brief log messaging facilities
- *  \ingroup LogTrace
- */
-
 #include <stdarg.h>
 
@@ -18,5 +29,7 @@
 /// In future versions, this procedure will take a character string as an
 /// argument which can specify more general log destinations.
-int psLogSetDestination(int dest);
+int psLogSetDestination(int dest     ///< Specifies where to send messages.
+                       );
+
 
 /// This procedure sets the message level for future log messages.  Subsequent
@@ -25,5 +38,7 @@
 /// Ie. higher values set by this procedure will cause more log messages to
 /// be displayed.
-int psLogSetLevel(int level);
+int psLogSetLevel(int level          ///< Specifies the system log level
+                 );
+
 
 /// This procedure sets the log format for future log messages.  The argument
@@ -32,5 +47,6 @@
 /// Deleting a letter from the string will cause the associated information
 /// to not be logged.
-void psLogSetFormat(const char *fmt);
+void psLogSetFormat(const char *fmt ///< Specifies the system log format
+                   );
 
 
@@ -41,7 +57,6 @@
 void psLogMsg(const char *name,     ///< name of the log source
               int myLevel,          ///< severity level of this log message
-              const char *fmt, ...) ///< printf-style format command
-;
-
+              const char *fmt, ...  ///< printf-style format command
+             );
 
 
@@ -51,7 +66,6 @@
                int myLevel,      ///< severity level of this log message
                const char *fmt,  ///< printf-style format command
-               va_list ap)       ///< varargs argument list
-;
-
+               va_list ap        ///< varargs argument list
+              );
 
 ///< Status codes for log messages
Index: /trunk/psLib/src/sys/psTrace.c
===================================================================
--- /trunk/psLib/src/sys/psTrace.c	(revision 1012)
+++ /trunk/psLib/src/sys/psTrace.c	(revision 1013)
@@ -1,7 +1,18 @@
-/*****************************************************************************
-    A simple implementation of a tracing facility for Pan-STARRS.  Tracing
-    is controlled on a per "component" basis, where a "component" is a name
-    of the form aaa.bbb.ccc where aaa is the most significant part.
- 
+/** @file psTrace.c
+ *  \brief basic run-time trace facilities
+ *  \ingroup LogTrace
+ *
+ *  This file will hold the code for procedures to insert
+ *  trace messages into the code.
+ *
+ *  @author Robert Lupton, Princeton University
+ *  @author George Gusciora, MHPCC
+ *
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-12 05:50:01 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+/*****************************************************************************
     NOTES:
  In the SRD, higher trace levels correspond to a numerically lower trace
@@ -16,12 +27,4 @@
  trace level of that node.
  
- This code is obfuscated by the fact that component names are of the form
- ".a.b.c.d" where "." is always the root of the tree, and for tree that have
- a depth of 3 or higher (including the root ".") the "."  character is also
- the deliminator between different individual nodes in the full component
- name.  So, for ".a.b.c.d", the first "." signifies the root of the tree,
- while the last three dots merely act as separators between the node names
- "b", "c", and "d".
- 
  I added a function psTraceFree() which frees all nodes in the trace component
  tree.  Previously, there had been no function in the API which accomplished
@@ -32,5 +35,4 @@
 #include <string.h>
 #include <stdarg.h>
-/* #include "pslib.h" */
 #include "psMemory.h"
 #include "psTrace.h"
@@ -38,8 +40,8 @@
 #include "psError.h"
 
-static Component *croot = NULL;           // The root of the trace component
-static FILE *traceFP = NULL;
-/*****************************************************************************
-    componentAlloc(): allocate memory for a new node, and initialize members.
+static Component *p_psCroot = NULL;       // The root of the trace component
+static FILE *p_psTraceFP = NULL;          // File destination for messages.
+/*****************************************************************************
+componentAlloc(): allocate memory for a new node, and initialize members.
  *****************************************************************************/
 Component *componentAlloc(const char *name,
@@ -56,6 +58,6 @@
 
 /*****************************************************************************
-    componentFree(): free the current node in the root tree, and all
- children nodes as well.
+componentFree(): free the current node in the root tree, and all children
+nodes as well.
  *****************************************************************************/
 static void componentFree(Component *comp)
@@ -78,16 +80,16 @@
 
 /*****************************************************************************
-    initTrace(): simply initialize the component root tree.
+initTrace(): simply initialize the component root tree.
 *****************************************************************************/
 static void initTrace(void)
 {
-    if (croot == NULL) {
-        croot = componentAlloc(".", DEFAULT_TRACE_LEVEL);
-    }
-}
-
-
-/*****************************************************************************
-    Set all trace levels to zero.
+    if (p_psCroot == NULL) {
+        p_psCroot = componentAlloc(".", DEFAULT_TRACE_LEVEL);
+    }
+}
+
+
+/*****************************************************************************
+Set all trace levels to zero.
  *****************************************************************************/
 void p_psTraceReset(Component *currentNode)
@@ -112,36 +114,41 @@
 }
 
+/*****************************************************************************
+Set all trace levels to zero.
+ *****************************************************************************/
 void psTraceReset()
 {
-    p_psTraceReset(croot);
-}
-
-
+    p_psTraceReset(p_psCroot);
+}
+
+
+/*****************************************************************************
+Free all nodes in the component tree.
+ *****************************************************************************/
 void psTraceFree()
 {
-    componentFree(croot);
-}
-
-
-/*****************************************************************************
-    componentAdd(): Adds the component named "addNodeName" to the root tree.
+    componentFree(p_psCroot);
+}
+
+
+/*****************************************************************************
+componentAdd(): Adds the component named "addNodeName" to the root tree.
  
-    NOTE: replace the call to strsep() with a call to strtok(), which conforms
-    to ANSI-C.
+NOTE: replace the call to strsep() with a call to strtok(), which conforms
+to ANSI-C.
  *****************************************************************************/
 static void componentAdd(const char *addNodeName,
                          int         level)
 {
-    int        i = 0;
-    char       name[strlen(addNodeName) + 1];
-    // buffer for writeable copy.
+    int        i = 0;                         // Loop index variable.
+    char       name[strlen(addNodeName) + 1]; // buffer for writeable copy.
     char      *pname=name;
     char      *firstComponent = NULL;       // first component of name
-    Component *currentNode = croot;
+    Component *currentNode = p_psCroot;
     int        nodeExists = 0;
 
     // Is this the root node?  If so, simply set level and return.
     if (strcmp(".", addNodeName) == 0) {
-        croot->level = level;
+        p_psCroot->level = level;
         return;
     }
@@ -199,5 +206,5 @@
 {
     // If the root component tree does not exist, then initialize it.
-    if (croot == NULL) {
+    if (p_psCroot == NULL) {
         initTrace();
     }
@@ -230,5 +237,5 @@
     char      *pname=name;
     char      *firstComponent = NULL;   // first component of name
-    Component *currentNode = croot;
+    Component *currentNode = p_psCroot;
     int        i = 0;
 
@@ -238,5 +245,5 @@
 
     if (strcmp(".", aname) == 0) {
-        return(croot->level);
+        return(p_psCroot->level);
     }
 
@@ -282,5 +289,5 @@
 int psTraceGetLevel(const char *name)
 {
-    if (croot == NULL) {
+    if (p_psCroot == NULL) {
         return(UNKNOWN_TRACE_LEVEL);
     }
@@ -328,35 +335,35 @@
 
 /*****************************************************************************
-    psPrintTraceLevels()
- Simply print all the trace levels in the trace level component tree.
-    Inputs:
- none
-    Outputs:
- none
-    Returns:
+psPrintTraceLevels(): Simply print all the trace levels in the trace level
+component tree.
+Inputs:
+ none
+Outputs:
+ none
+Returns:
  null
 *****************************************************************************/
 void psTracePrintLevels(void)
 {
-    if (croot == NULL) {
+    if (p_psCroot == NULL) {
         return;
     }
 
-    doPrintTraceLevels(croot, 0);
-}
-
-
-/*****************************************************************************
-    p_psTrace(): we display the trace message to standard output if the trace
- level of that message, supplied by the parameter "level" is higher
- than the trace level that is currently associated with the component
- named by the parameter "comp".
-    Input:
+    doPrintTraceLevels(p_psCroot, 0);
+}
+
+
+/*****************************************************************************
+p_psTrace(): we display the trace message to standard output if the trace
+level of that message, supplied by the parameter "level" is higher than the
+trace level that is currently associated with the component named by the
+parameter "comp".
+Input:
  comp
  level
  ...  a printf-style output string.
-    Output:
- none
-    Return:
+Output:
+ none
+Return:
  null
  *****************************************************************************/
@@ -384,10 +391,10 @@
         fmt = va_arg(ap, char *);
 
-        if (traceFP != NULL) {
+        if (p_psTraceFP != NULL) {
             // We indent each message one space for each level of the message.
             for (i = 0; i < level; i++) {
-                fprintf(traceFP, " ");
+                fprintf(p_psTraceFP, " ");
             }
-            vfprintf(traceFP, fmt, ap);
+            vfprintf(p_psTraceFP, fmt, ap);
         } else {
             // We indent each message one space for each level of the message.
@@ -405,4 +412,4 @@
 void psTraceSetDestination(FILE *fp)
 {
-    traceFP = fp;
-}
+    p_psTraceFP = fp;
+}
Index: /trunk/psLib/src/sys/psTrace.h
===================================================================
--- /trunk/psLib/src/sys/psTrace.h	(revision 1012)
+++ /trunk/psLib/src/sys/psTrace.h	(revision 1013)
@@ -1,2 +1,17 @@
+/** @file psTrace.h
+ *  \brief basic run-time trace facilities
+ *  \ingroup LogTrace
+ *
+ *  This file will hold the prototypes for defining procedures to insert
+ *  trace messages into the code.
+ *
+ *  @author Robert Lupton, Princeton University
+ *  @author George Gusciora, MHPCC
+ *
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-12 05:50:01 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
 #if !defined(PS_TRACE_H)
 #define PS_TRACE_H 1
@@ -4,14 +19,8 @@
 #define DEFAULT_TRACE_LEVEL 0
 
-/** \file psTrace.h
- *  \brief basic run-time trace facilities
- *  \ingroup LogTrace
- */
-
-/*****************************************************************************
-    A component is a string of the form aaa.bbb.ccc, and may itself contain
-    further subcomponents.  The Component structure doesn't in fact contain
-    it's full name, but only the last part.
- *****************************************************************************/
+/** Basic structure for the component tree.  A component is a string of the
+    form aaa.bbb.ccc, and may itself contain further subcomponents.  The
+    Component structure doesn't in fact contain it's full name, but only the
+    last part. */
 typedef struct Component
 {
@@ -26,5 +35,4 @@
  *  \{
  */
-
 
 /** Functions **************************************************************/
@@ -59,4 +67,5 @@
 ;
 
+/// Set the destination of future trace messages.
 void psTraceSetDestination(FILE *fp);
 
Index: /trunk/psLib/src/sysUtils/psHash.h
===================================================================
--- /trunk/psLib/src/sysUtils/psHash.h	(revision 1012)
+++ /trunk/psLib/src/sysUtils/psHash.h	(revision 1013)
@@ -1,5 +1,5 @@
 /** @file  psHash.h
- *
  *  @brief Contains support for basic hashing functions.
+ *  @ingroup HashTable
  *
  *  This file will hold the prototypes for defining a hash table with arbitrary
@@ -7,15 +7,12 @@
  *  data from that hash table, and listing all keys defined in the hash table.
  *
- *  @ingroup HashTable
- *
  *  @author Robert Lupton, Princeton University
  *  @author George Gusciora, MHPCC
  *   
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-12 04:55:21 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-12 05:50:01 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
-
 #if !defined(PS_HASH_H)
 #define PS_HASH_H
@@ -25,5 +22,4 @@
  */
 #include "psList.h"
-
 
 /** A bucket that holds an item of data. */
@@ -40,11 +36,12 @@
 typedef struct psHash
 {
-    int nbucket;                        //< Number of buckets in hash table.
-    psHashBucket **buckets;             //< The bucket data.
+    int nbucket;                        ///< Number of buckets in hash table.
+    psHashBucket **buckets;             ///< The bucket data.
 }
 psHash;
 
 /// Allocate hash buckets in table.
-psHash *psHashAlloc(int nbucket);
+psHash *psHashAlloc(int nbucket       ///< The number of buckets to allocate.
+                   );
 
 /// Free hash buckets from table.
Index: /trunk/psLib/src/sysUtils/psLogMsg.c
===================================================================
--- /trunk/psLib/src/sysUtils/psLogMsg.c	(revision 1012)
+++ /trunk/psLib/src/sysUtils/psLogMsg.c	(revision 1013)
@@ -1,13 +1,29 @@
-/*****************************************************************************
-    A simple implementation of a logging facility for Pan-STARRS
- 
+/** @file  psLogMsg.c
+ *  @brief Procedures for logging messages.
+ *  \ingroup LogTrace
+ *
+ *  This file will hold the prototypes for defining procedure which set
+ *  message log levels, messahe log formats, message log destinations, and
+ *  for generating the messages themselves.
+ *  @ingroup LogTrace
+ *
+ *  @author Robert Lupton, Princeton University
+ *  @author George Gusciora, MHPCC
+ *
+ *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-12 05:50:01 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+
+/*****************************************************************************
 NOTES: currently, the prototype code has the following global variables:
-    static int logDest;
-    static int logLevel;
-    static int log_time;
-    static int log_host;
-    static int log_level;
-    static int log_name;
-    static int log_msg;
+    static int p_psGlobalLogDest;
+    static int p_psGlobalLogLevel;
+    static int p_psLogTime;
+    static int p_psLogHost;
+    static int p_psLogLevel;
+    static int p_psLogName;
+    static int p_psLogMsg;
  *****************************************************************************/
 #include <limits.h>
@@ -18,6 +34,4 @@
 #include <time.h>
 #include <unistd.h>
-
-/* #include "psLib.h" */
 #include "psLogMsg.h"
 #include "psError.h"
@@ -27,15 +41,15 @@
 #define MIN_LOG_LEVEL 0
 #define MAX_LOG_LEVEL 9
-static int logDest = PS_LOG_TO_STDERR; // where to log messages
-static int logLevel = PS_LOG_INFO;     // log all messages at this or above
+static int p_psGlobalLogDest = PS_LOG_TO_STDERR; // where to log messages
+static int p_psGlobalLogLevel = PS_LOG_INFO;     // log all messages at this or above
 //static FILE *p_logFP = NULL;
 // The following variables control
 // which information is displayed in
 // log messages.
-static int log_time = 1;                // Flag to include time info
-static int log_host = 1;                // Flag to include host info
-static int log_level = 1;               // Flag to include level info
-static int log_name = 1;                // Flag to include name info
-static int log_msg = 1;                 // Flag to include message info
+static int p_psLogTime = 1;                // Flag to include time info
+static int p_psLogHost = 1;                // Flag to include host info
+static int p_psLogLevel = 1;               // Flag to include level info
+static int p_psLogName = 1;                // Flag to include name info
+static int p_psLogMsg = 1;                 // Flag to include message info
 /*****************************************************************************
 psLogSetLevel(): Set the current log level and return old level.
@@ -49,5 +63,6 @@
 int psLogSetLevel(int level)
 {
-    int oldLevel = logLevel;
+    // Save old global log level for changing it.
+    int oldLevel = p_psGlobalLogLevel;
 
     if ((level < MIN_LOG_LEVEL) || (level > MAX_LOG_LEVEL)) {
@@ -57,5 +72,8 @@
     }
 
-    logLevel = level;
+    // Set new global log level
+    p_psGlobalLogLevel = level;
+
+    // Return old global log level
     return oldLevel;
 }
@@ -75,5 +93,6 @@
 int psLogSetDestination(int dest)
 {
-    int old = logDest;
+    // Save old global log destination before changing it.
+    int old = p_psGlobalLogDest;
 
     switch (dest) {
@@ -81,13 +100,15 @@
     case PS_LOG_TO_STDOUT:
     case PS_LOG_TO_STDERR:
-        logDest = dest;
+        // Set new global log destination
+        p_psGlobalLogDest = dest;
         break;
 
     default:
         // GUS: Should you log this error properly?
-        fprintf(stderr,"Unknown logDestination: %d (ignored)\n", dest);
-        break;
-    }
-
+        fprintf(stderr,"Unknown p_psGlobalLogDest: %d (ignored)\n", dest);
+        break;
+    }
+
+    // Return old global log destination
     return old;
 }
@@ -112,9 +133,7 @@
 void psLogSetFormat(const char *fmt)
 {
-    int nlog_time = 0;
-    int nlog_host = 0;
-    int nlog_level = 0;
-    int nlog_name = 0;
-    int nlog_msg = 0;
+
+    // Step through each character in the format string.  For each letter
+    // in that string, set/unset the appropriate logging.
 
     for (const char *ptr = fmt; *ptr != '\0'; ptr++) {
@@ -122,26 +141,23 @@
         case 'H':
         case 'h':
-            nlog_host = 1;
+            p_psLogHost = 1;
             break;
         case 'L':
         case 'l':
-            nlog_level = 1;
+            p_psLogLevel = 1;
             break;
         case 'M':
         case 'm':
-            nlog_msg = 1;
+            p_psLogMsg = 1;
             break;
         case 'N':
         case 'n':
-            nlog_name = 1;
+            p_psLogName = 1;
             break;
         case 'T':
         case 't':
-            nlog_time = 1;
+            p_psLogTime = 1;
             break;
         default:
-            // GUS: figure out the psError() format:
-            //     psError(__func__, PS_ERR_UNKNOWN, 1,
-            //            "Unknown logging keyword %c", *ptr);
             psError(__func__, "Unknown logging keyword %c", *ptr);
             break;
@@ -149,15 +165,9 @@
     }
 
-    if (!nlog_msg) {
+    if (!p_psLogMsg) {
         psTrace("utils.logMsg", 1,
                 "You must at least log error messages (You chose \"%s\")",
                 fmt);
     }
-
-    log_host = nlog_host;
-    log_level = nlog_level;
-    log_msg = nlog_msg;
-    log_name = nlog_name;
-    log_time = nlog_time;
 }
 
@@ -186,16 +196,19 @@
                va_list ap)
 {
-    static int first = 1;
+    static int first = 1;               // Flag for calling gethostname()
     static char hostname[HOST_NAME_MAX + 1];
+    // Buffer for hostname.
     char clevel=0;                      // letter-name for level
     char head[HOST_NAME_MAX + 40];      // yes, this is long enough
     char *head_ptr = head;              // where we've got to in head
-    time_t clock = time(NULL);
-    struct tm *utc = gmtime(&clock);
-
-    if ((level > logLevel) || (logDest == PS_LOG_NONE)) {
+    time_t clock = time(NULL);          // The current time.
+    struct tm *utc = gmtime(&clock);    // The current gm time.
+
+    // If logging is off, or if the level is too high, return immediately.
+    if ((level > p_psGlobalLogLevel) || (p_psGlobalLogDest == PS_LOG_NONE)) {
         return;
     }
 
+    // If I have not been here yet, determine my hostname and save it.
     if (first) {
         first = 0;
@@ -236,6 +249,6 @@
     }
 
-
-    if (log_time) {
+    // Create the various log fields...
+    if (p_psLogTime) {
         sprintf(head_ptr, "%4d:%02d:%02d %02d:%02d:%02dZ",
                 utc->tm_year + 1900, utc->tm_mon + 1, utc->tm_mday,
@@ -243,5 +256,6 @@
         head_ptr += strlen(head_ptr);
     }
-    if (log_host) {
+    // Hostname should be 20 characters.
+    if (p_psLogHost) {
         if (head_ptr > head) {
             *head_ptr++ = '|';
@@ -250,5 +264,5 @@
         head_ptr += strlen(head_ptr);
     }
-    if (log_level) {
+    if (p_psLogLevel) {
         if (head_ptr > head) {
             *head_ptr++ = '|';
@@ -257,9 +271,10 @@
         head_ptr += strlen(head_ptr);
     }
-    if (log_name) {
+    // The name field must be 15 characters.
+    if (p_psLogName) {
         if (head_ptr > head) {
             *head_ptr++ = '|';
         }
-        sprintf(head_ptr, "%-15s", name);
+        sprintf(head_ptr, "%15.15s", name);
         head_ptr += strlen(head_ptr);
     }
@@ -270,8 +285,8 @@
     *head_ptr = '\0';
 
-    switch (logDest) {
+    switch (p_psGlobalLogDest) {
     case PS_LOG_TO_STDOUT:
         puts(head);
-        if (log_msg) {
+        if (p_psLogMsg) {
             vprintf(fmt, ap);
             if (fmt[strlen(fmt) - 1] != '\n') {
@@ -285,5 +300,5 @@
     case PS_LOG_TO_STDERR:
         fputs(head, stderr);
-        if (log_msg) {
+        if (p_psLogMsg) {
             vfprintf(stderr, fmt, ap);
             if (fmt[strlen(fmt) - 1] != '\n') {
Index: /trunk/psLib/src/sysUtils/psLogMsg.h
===================================================================
--- /trunk/psLib/src/sysUtils/psLogMsg.h	(revision 1012)
+++ /trunk/psLib/src/sysUtils/psLogMsg.h	(revision 1013)
@@ -1,10 +1,21 @@
+/** @file  psLogMsg.h
+ *  @brief Procedures for logging messages.
+ *  \ingroup LogTrace
+ *
+ *  This file will hold the prototypes for defining procedure which set
+ *  message log levels, messahe log formats, message log destinations, and
+ *  for generating the messages themselves.
+ *  @ingroup LogTrace
+ *
+ *  @author Robert Lupton, Princeton University
+ *  @author George Gusciora, MHPCC
+ *
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-12 05:50:01 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
 #if !defined(PS_LOG_MSG_H)
 #define PS_LOG_MSG_H
-
-/** \file psLogMsg.h
- *  \brief log messaging facilities
- *  \ingroup LogTrace
- */
-
 #include <stdarg.h>
 
@@ -18,5 +29,7 @@
 /// In future versions, this procedure will take a character string as an
 /// argument which can specify more general log destinations.
-int psLogSetDestination(int dest);
+int psLogSetDestination(int dest     ///< Specifies where to send messages.
+                       );
+
 
 /// This procedure sets the message level for future log messages.  Subsequent
@@ -25,5 +38,7 @@
 /// Ie. higher values set by this procedure will cause more log messages to
 /// be displayed.
-int psLogSetLevel(int level);
+int psLogSetLevel(int level          ///< Specifies the system log level
+                 );
+
 
 /// This procedure sets the log format for future log messages.  The argument
@@ -32,5 +47,6 @@
 /// Deleting a letter from the string will cause the associated information
 /// to not be logged.
-void psLogSetFormat(const char *fmt);
+void psLogSetFormat(const char *fmt ///< Specifies the system log format
+                   );
 
 
@@ -41,7 +57,6 @@
 void psLogMsg(const char *name,     ///< name of the log source
               int myLevel,          ///< severity level of this log message
-              const char *fmt, ...) ///< printf-style format command
-;
-
+              const char *fmt, ...  ///< printf-style format command
+             );
 
 
@@ -51,7 +66,6 @@
                int myLevel,      ///< severity level of this log message
                const char *fmt,  ///< printf-style format command
-               va_list ap)       ///< varargs argument list
-;
-
+               va_list ap        ///< varargs argument list
+              );
 
 ///< Status codes for log messages
Index: /trunk/psLib/src/sysUtils/psTrace.c
===================================================================
--- /trunk/psLib/src/sysUtils/psTrace.c	(revision 1012)
+++ /trunk/psLib/src/sysUtils/psTrace.c	(revision 1013)
@@ -1,7 +1,18 @@
-/*****************************************************************************
-    A simple implementation of a tracing facility for Pan-STARRS.  Tracing
-    is controlled on a per "component" basis, where a "component" is a name
-    of the form aaa.bbb.ccc where aaa is the most significant part.
- 
+/** @file psTrace.c
+ *  \brief basic run-time trace facilities
+ *  \ingroup LogTrace
+ *
+ *  This file will hold the code for procedures to insert
+ *  trace messages into the code.
+ *
+ *  @author Robert Lupton, Princeton University
+ *  @author George Gusciora, MHPCC
+ *
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-12 05:50:01 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+/*****************************************************************************
     NOTES:
  In the SRD, higher trace levels correspond to a numerically lower trace
@@ -16,12 +27,4 @@
  trace level of that node.
  
- This code is obfuscated by the fact that component names are of the form
- ".a.b.c.d" where "." is always the root of the tree, and for tree that have
- a depth of 3 or higher (including the root ".") the "."  character is also
- the deliminator between different individual nodes in the full component
- name.  So, for ".a.b.c.d", the first "." signifies the root of the tree,
- while the last three dots merely act as separators between the node names
- "b", "c", and "d".
- 
  I added a function psTraceFree() which frees all nodes in the trace component
  tree.  Previously, there had been no function in the API which accomplished
@@ -32,5 +35,4 @@
 #include <string.h>
 #include <stdarg.h>
-/* #include "pslib.h" */
 #include "psMemory.h"
 #include "psTrace.h"
@@ -38,8 +40,8 @@
 #include "psError.h"
 
-static Component *croot = NULL;           // The root of the trace component
-static FILE *traceFP = NULL;
-/*****************************************************************************
-    componentAlloc(): allocate memory for a new node, and initialize members.
+static Component *p_psCroot = NULL;       // The root of the trace component
+static FILE *p_psTraceFP = NULL;          // File destination for messages.
+/*****************************************************************************
+componentAlloc(): allocate memory for a new node, and initialize members.
  *****************************************************************************/
 Component *componentAlloc(const char *name,
@@ -56,6 +58,6 @@
 
 /*****************************************************************************
-    componentFree(): free the current node in the root tree, and all
- children nodes as well.
+componentFree(): free the current node in the root tree, and all children
+nodes as well.
  *****************************************************************************/
 static void componentFree(Component *comp)
@@ -78,16 +80,16 @@
 
 /*****************************************************************************
-    initTrace(): simply initialize the component root tree.
+initTrace(): simply initialize the component root tree.
 *****************************************************************************/
 static void initTrace(void)
 {
-    if (croot == NULL) {
-        croot = componentAlloc(".", DEFAULT_TRACE_LEVEL);
-    }
-}
-
-
-/*****************************************************************************
-    Set all trace levels to zero.
+    if (p_psCroot == NULL) {
+        p_psCroot = componentAlloc(".", DEFAULT_TRACE_LEVEL);
+    }
+}
+
+
+/*****************************************************************************
+Set all trace levels to zero.
  *****************************************************************************/
 void p_psTraceReset(Component *currentNode)
@@ -112,36 +114,41 @@
 }
 
+/*****************************************************************************
+Set all trace levels to zero.
+ *****************************************************************************/
 void psTraceReset()
 {
-    p_psTraceReset(croot);
-}
-
-
+    p_psTraceReset(p_psCroot);
+}
+
+
+/*****************************************************************************
+Free all nodes in the component tree.
+ *****************************************************************************/
 void psTraceFree()
 {
-    componentFree(croot);
-}
-
-
-/*****************************************************************************
-    componentAdd(): Adds the component named "addNodeName" to the root tree.
+    componentFree(p_psCroot);
+}
+
+
+/*****************************************************************************
+componentAdd(): Adds the component named "addNodeName" to the root tree.
  
-    NOTE: replace the call to strsep() with a call to strtok(), which conforms
-    to ANSI-C.
+NOTE: replace the call to strsep() with a call to strtok(), which conforms
+to ANSI-C.
  *****************************************************************************/
 static void componentAdd(const char *addNodeName,
                          int         level)
 {
-    int        i = 0;
-    char       name[strlen(addNodeName) + 1];
-    // buffer for writeable copy.
+    int        i = 0;                         // Loop index variable.
+    char       name[strlen(addNodeName) + 1]; // buffer for writeable copy.
     char      *pname=name;
     char      *firstComponent = NULL;       // first component of name
-    Component *currentNode = croot;
+    Component *currentNode = p_psCroot;
     int        nodeExists = 0;
 
     // Is this the root node?  If so, simply set level and return.
     if (strcmp(".", addNodeName) == 0) {
-        croot->level = level;
+        p_psCroot->level = level;
         return;
     }
@@ -199,5 +206,5 @@
 {
     // If the root component tree does not exist, then initialize it.
-    if (croot == NULL) {
+    if (p_psCroot == NULL) {
         initTrace();
     }
@@ -230,5 +237,5 @@
     char      *pname=name;
     char      *firstComponent = NULL;   // first component of name
-    Component *currentNode = croot;
+    Component *currentNode = p_psCroot;
     int        i = 0;
 
@@ -238,5 +245,5 @@
 
     if (strcmp(".", aname) == 0) {
-        return(croot->level);
+        return(p_psCroot->level);
     }
 
@@ -282,5 +289,5 @@
 int psTraceGetLevel(const char *name)
 {
-    if (croot == NULL) {
+    if (p_psCroot == NULL) {
         return(UNKNOWN_TRACE_LEVEL);
     }
@@ -328,35 +335,35 @@
 
 /*****************************************************************************
-    psPrintTraceLevels()
- Simply print all the trace levels in the trace level component tree.
-    Inputs:
- none
-    Outputs:
- none
-    Returns:
+psPrintTraceLevels(): Simply print all the trace levels in the trace level
+component tree.
+Inputs:
+ none
+Outputs:
+ none
+Returns:
  null
 *****************************************************************************/
 void psTracePrintLevels(void)
 {
-    if (croot == NULL) {
+    if (p_psCroot == NULL) {
         return;
     }
 
-    doPrintTraceLevels(croot, 0);
-}
-
-
-/*****************************************************************************
-    p_psTrace(): we display the trace message to standard output if the trace
- level of that message, supplied by the parameter "level" is higher
- than the trace level that is currently associated with the component
- named by the parameter "comp".
-    Input:
+    doPrintTraceLevels(p_psCroot, 0);
+}
+
+
+/*****************************************************************************
+p_psTrace(): we display the trace message to standard output if the trace
+level of that message, supplied by the parameter "level" is higher than the
+trace level that is currently associated with the component named by the
+parameter "comp".
+Input:
  comp
  level
  ...  a printf-style output string.
-    Output:
- none
-    Return:
+Output:
+ none
+Return:
  null
  *****************************************************************************/
@@ -384,10 +391,10 @@
         fmt = va_arg(ap, char *);
 
-        if (traceFP != NULL) {
+        if (p_psTraceFP != NULL) {
             // We indent each message one space for each level of the message.
             for (i = 0; i < level; i++) {
-                fprintf(traceFP, " ");
+                fprintf(p_psTraceFP, " ");
             }
-            vfprintf(traceFP, fmt, ap);
+            vfprintf(p_psTraceFP, fmt, ap);
         } else {
             // We indent each message one space for each level of the message.
@@ -405,4 +412,4 @@
 void psTraceSetDestination(FILE *fp)
 {
-    traceFP = fp;
-}
+    p_psTraceFP = fp;
+}
Index: /trunk/psLib/src/sysUtils/psTrace.h
===================================================================
--- /trunk/psLib/src/sysUtils/psTrace.h	(revision 1012)
+++ /trunk/psLib/src/sysUtils/psTrace.h	(revision 1013)
@@ -1,2 +1,17 @@
+/** @file psTrace.h
+ *  \brief basic run-time trace facilities
+ *  \ingroup LogTrace
+ *
+ *  This file will hold the prototypes for defining procedures to insert
+ *  trace messages into the code.
+ *
+ *  @author Robert Lupton, Princeton University
+ *  @author George Gusciora, MHPCC
+ *
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-12 05:50:01 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
 #if !defined(PS_TRACE_H)
 #define PS_TRACE_H 1
@@ -4,14 +19,8 @@
 #define DEFAULT_TRACE_LEVEL 0
 
-/** \file psTrace.h
- *  \brief basic run-time trace facilities
- *  \ingroup LogTrace
- */
-
-/*****************************************************************************
-    A component is a string of the form aaa.bbb.ccc, and may itself contain
-    further subcomponents.  The Component structure doesn't in fact contain
-    it's full name, but only the last part.
- *****************************************************************************/
+/** Basic structure for the component tree.  A component is a string of the
+    form aaa.bbb.ccc, and may itself contain further subcomponents.  The
+    Component structure doesn't in fact contain it's full name, but only the
+    last part. */
 typedef struct Component
 {
@@ -26,5 +35,4 @@
  *  \{
  */
-
 
 /** Functions **************************************************************/
@@ -59,4 +67,5 @@
 ;
 
+/// Set the destination of future trace messages.
 void psTraceSetDestination(FILE *fp);
 
