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 George Gusciora, MHPCC 00012 * 00013 * @version $Revision: 1.22 $ $Name: rel5_0 $ 00014 * @date $Date: 2005/03/22 21:52:49 $ 00015 * 00016 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 00017 */ 00018 #if !defined(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. Currently 00029 * the destination is specified by an integer which can have the following 00030 * pre-defined values: PS_LOG_NONE, PS_LOG_TO_STDOUT, and PS_LOG_TO_STDERR. 00031 * In future versions, this procedure will take a character string as an 00032 * argument which can specify more general log destinations. 00033 * 00034 * @return psS32 true if set successfully, otherwise false. 00035 */ 00036 psBool psLogSetDestination( 00037 const char *dest ///< Specifies where to send messages. 00038 ); 00039 00040 /** This procedure sets the message level for future log messages. Subsequent 00041 * log messages, with a log level of "mylevel", will only be logged if 00042 * "mylevel" is less than the current log level set by this procedure. 00043 * Ie. higher values set by this procedure will cause more log messages to 00044 * be displayed. 00045 * 00046 * @return psS32 old logging level 00047 */ 00048 psS32 psLogSetLevel( 00049 psS32 level ///< Specifies the system log level 00050 ); 00051 00052 /** This procedure sets the log format for future log messages. The argument 00053 * must be a character string consistsing of the letters H (host), L 00054 * (level), M (message), N (name), and T (time). The default is "THLNM". 00055 * Deleting a letter from the string will cause the associated information 00056 * to not be logged. 00057 * 00058 */ 00059 void psLogSetFormat( 00060 const char *fmt ///< Specifies the system log format 00061 ); 00062 00063 /** This procedure logs a message to the destination set by a prior 00064 * call to psLogSetDestination(), if myLevel is less than the level 00065 * specified by a prior call to psLogSetLevel(). The message is specified 00066 * with a printf-stype string an arguments. 00067 * 00068 */ 00069 void psLogMsg( 00070 const char *name, ///< name of the log source 00071 psS32 myLevel, ///< severity level of this log message 00072 const char *fmt, ///< printf-style format command 00073 ... 00074 ); 00075 00076 #ifndef SWIG 00077 /** This procedure is functionally equivalent to psLogMsg(), except that 00078 * it takes a va_list as the message parameter, not a printf-style string. 00079 * 00080 */ 00081 void psLogMsgV( 00082 const char *name, ///< name of the log source 00083 psS32 myLevel, ///< severity level of this log message 00084 const char *fmt, ///< printf-style format command 00085 va_list ap ///< varargs argument list 00086 ); 00087 #endif 00088 00089 ///< Status codes for log messages 00090 enum { 00091 PS_LOG_ABORT = 0, ///< log message is a critical error, perform an abort after printing 00092 PS_LOG_ERROR, ///< log message is an error, but don't abort 00093 PS_LOG_WARN, ///< log message is a warning 00094 PS_LOG_INFO ///< log message is informational only 00095 }; 00096 00097 ///< Destinations for log messages 00098 enum { 00099 PS_LOG_NONE, ///< turn off logging 00100 PS_LOG_TO_STDERR, ///< log to system's stderr 00101 PS_LOG_TO_STDOUT ///< log to system's stdout 00102 }; 00103 00104 /// @} 00105 00106 #endif
1.3.9.1