Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

psLogMsg.h

Go to the documentation of this file.
00001 /** @file  psLogMsg.h
00002  *  @brief Procedures for logging messages.
00003  *  \ingroup LogTrace
00004  *
00005  *  This file will hold the prototypes for defining procedure which set
00006  *  message log levels, messahe log formats, message log destinations, and
00007  *  for generating the messages themselves.
00008  *  @ingroup LogTrace
00009  *
00010  *  @author Robert Lupton, Princeton University
00011  *  @author GLG, MHPCC
00012  *
00013  *  @version $Revision: 1.1.1.1 $ $Name:  $
00014  *  @date $Date: 2005/06/15 21:08:12 $
00015  *
00016  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00017  */
00018 #ifndef PS_LOG_MSG_H
00019 #define PS_LOG_MSG_H
00020 #include <stdarg.h>
00021 
00022 #include "psType.h"
00023 
00024 /** @addtogroup LogTrace
00025  *  @{
00026  */
00027 
00028 /** This procedure sets the destination for future log messages.
00029  *  This procedure will take a character string as an
00030  *  argument which can specify general log destinations.
00031  *
00032  *  @return psS32     true if set successfully, otherwise false.
00033  */
00034 psBool psLogSetDestination(
00035     const char *dest                   ///< Specifies where to send messages.
00036 );
00037 
00038 /** This procedure sets the message level for future log messages.  Subsequent
00039  *  log messages, with a log level of "mylevel", will only be logged if
00040  *  "mylevel" is less than the current log level set by this procedure.
00041  *  Ie. higher values set by this procedure will cause more log messages to
00042  *  be displayed.  The old log level will be returned.
00043  *
00044  *  @return psS32    old logging level
00045  */
00046 psS32 psLogSetLevel(
00047     psS32 level                          ///< Specifies the system log level
00048 );
00049 
00050 /** This procedure sets the log format for future log messages.  The argument
00051  *  must be a character string consistsing of the letters H (host), L
00052  *  (level), M (message), N (name), and T (time).  The default is "THLNM".
00053  *  Deleting a letter from the string will cause the associated information
00054  *  to not be logged.  This procedure does not alter the order in which
00055  *  the messages are displayed.
00056  */
00057 void psLogSetFormat(
00058     const char *fmt                    ///< Specifies the system log format
00059 );
00060 
00061 /** This procedure logs a message to the destination set by a prior
00062  *  call to psLogSetDestination(), if myLevel is less than the level
00063  *  specified by a prior call to psLogSetLevel().  The message is specified
00064  *  with a printf-type string and arguments.
00065  *
00066  */
00067 void psLogMsg(
00068     const char *name,                  ///< name of the log source
00069     psS32 myLevel,                       ///< severity level of this log message
00070     const char *fmt,                   ///< printf-style format command
00071     ...
00072 );
00073 
00074 #ifndef SWIG
00075 /** This procedure is functionally equivalent to psLogMsg(), except that
00076  *  it takes a va_list as the message parameter, not a printf-style string.
00077  *
00078  */
00079 void psLogMsgV(
00080     const char *name,                  ///< name of the log source
00081     psS32 myLevel,                       ///< severity level of this log message
00082     const char *fmt,                   ///< printf-style format command
00083     va_list ap                         ///< varargs argument list
00084 );
00085 #endif // #ifndef SWIG
00086 
00087 ///< Status codes for log messages
00088 enum {
00089     PS_LOG_ABORT = 0,                  ///< log message is a critical error, perform an abort after printing
00090     PS_LOG_ERROR,                      ///< log message is an error, but don't abort
00091     PS_LOG_WARN,                       ///< log message is a warning
00092     PS_LOG_INFO                        ///< log message is informational only
00093 };
00094 
00095 ///< Destinations for log messages
00096 enum {
00097     PS_LOG_NONE,                       ///< turn off logging
00098     PS_LOG_TO_STDERR,                  ///< log to system's stderr
00099     PS_LOG_TO_STDOUT                   ///< log to system's stdout
00100 };
00101 
00102 /// @}
00103 
00104 #endif // #ifndef PS_LOG_MSG_H

Generated on Wed Jun 15 11:00:57 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.1