Changeset 2204 for trunk/psLib/src/sys/psLogMsg.c
- Timestamp:
- Oct 26, 2004, 2:57:34 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sys/psLogMsg.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psLogMsg.c
r1807 r2204 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 09-14 20:01:52$13 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 /***************************************************************************** 20 20 NOTES: currently, the prototype code has the following global variables: 21 static intp_psGlobalLogDest;22 static intp_psGlobalLogLevel;23 static intp_psLogTime;24 static intp_psLogHost;25 static intp_psLogLevel;26 static intp_psLogName;27 static intp_psLogMsg;21 static psS32 p_psGlobalLogDest; 22 static psS32 p_psGlobalLogLevel; 23 static psS32 p_psLogTime; 24 static psS32 p_psLogHost; 25 static psS32 p_psLogLevel; 26 static psS32 p_psLogName; 27 static psS32 p_psLogMsg; 28 28 *****************************************************************************/ 29 29 #include <limits.h> … … 34 34 #include <time.h> 35 35 #include <unistd.h> 36 #include <stdbool.h>37 36 38 37 #include "psLogMsg.h" … … 49 48 50 49 static FILE *logDest = (FILE *) 1; // flag to initialize to stderr before using. 51 static intglobalLogLevel = PS_LOG_INFO; // log all messages at this or above52 static bool logTime = true; // Flag to include time info53 static bool logHost = true; // Flag to include host info54 static bool logLevel = true; // Flag to include level info55 static bool logName = true; // Flag to include name info56 static bool logMsg = true; // Flag to include message info50 static psS32 globalLogLevel = PS_LOG_INFO; // log all messages at this or above 51 static psBool logTime = true; // Flag to include time info 52 static psBool logHost = true; // Flag to include host info 53 static psBool logLevel = true; // Flag to include level info 54 static psBool logName = true; // Flag to include name info 55 static psBool logMsg = true; // Flag to include message info 57 56 58 57 /***************************************************************************** 59 58 psLogSetLevel(): Set the current log level and return old level. 60 59 Input: 61 level ( int): the new log level.60 level (psS32): the new log level. 62 61 Output: 63 62 none … … 65 64 The old log level. 66 65 *****************************************************************************/ 67 int psLogSetLevel(intlevel)66 psS32 psLogSetLevel(psS32 level) 68 67 { 69 68 // Save old global log level for changing it. 70 intoldLevel = globalLogLevel;69 psS32 oldLevel = globalLogLevel; 71 70 72 71 if ((level < MIN_LOG_LEVEL) || (level > MAX_LOG_LEVEL)) { … … 86 85 87 86 Input: 88 dest ( int): the new log destination87 dest (psS32): the new log destination 89 88 Output: 90 89 None. … … 92 91 An integer specifying the old log destination. 93 92 *****************************************************************************/ 94 bool psLogSetDestination(const char *dest)93 psBool psLogSetDestination(const char *dest) 95 94 { 96 95 char protocol[5]; … … 245 244 NULL. 246 245 *****************************************************************************/ 247 void psLogMsgV(const char *name, intlevel, const char *fmt, va_list ap)248 { 249 static intfirst = 1; // Flag for calling gethostname()246 void psLogMsgV(const char *name, psS32 level, const char *fmt, va_list ap) 247 { 248 static psS32 first = 1; // Flag for calling gethostname() 250 249 static char hostname[HOST_NAME_MAX + 1]; 251 250 … … 254 253 char head[MAX_LOG_LINE_LENGTH + 2]; // the added two are for the ending | and \0 255 254 char *head_ptr = head; // where we've got to in head 256 intmaxLength = MAX_LOG_LINE_LENGTH;255 psS32 maxLength = MAX_LOG_LINE_LENGTH; 257 256 time_t clock = time(NULL); // The current time. 258 257 struct tm *utc = gmtime(&clock); // The current gm time. … … 375 374 NULL 376 375 *****************************************************************************/ 377 void psLogMsg(const char *name, intlevel, const char *fmt, ...)376 void psLogMsg(const char *name, psS32 level, const char *fmt, ...) 378 377 { 379 378 va_list ap;
Note:
See TracChangeset
for help on using the changeset viewer.
