29 #define ENTERCS if(m_csMessage!=NULL) EnterCriticalSection(m_csMessage);
31 #define LEAVECS if(m_csMessage!=NULL) LeaveCriticalSection(m_csMessage);
44 CMessage::CMessage(
const char* pcClassName,
int iDebuglevel,
bool bDebug,
bool bDebugFile) : m_bDebug(bDebug), m_bDebugFile(bDebugFile), m_iDebugLevel(iDebuglevel)
49 CMessage::CMessage(
const CMessage& clMessage) : m_bDebug(clMessage.m_bDebug), m_bDebugFile(clMessage.m_bDebugFile), m_iDebugLevel(clMessage.m_iDebugLevel)
103 clock_gettime(CLOCK_REALTIME,&nowTimeVal);
105 +(double(nowTimeVal.tv_nsec)/1e+9));
106 #elif defined(_WIN32)
110 +(double(nowTimeVal.millitm)/1e+3));
113 gettimeofday(&nowTimeVal,0);
115 +(double(nowTimeVal.tv_usec)/1e+6));
157 va_start(args, pcErrorMessage);
161 clock_gettime(CLOCK_REALTIME,&nowTimeVal);
162 double fSeconds = (nowTimeVal.tv_sec
164 #elif defined(_WIN32)
167 double fSeconds = (nowTimeVal.time
171 gettimeofday(&nowTimeVal,0);
172 double fSeconds = (nowTimeVal.tv_sec
176 static char acBuffer[255];
177 static char acOutBuffer[300];
178 vsprintf(acBuffer, pcErrorMessage, args);
179 sprintf(acOutBuffer,
"\nERROR: %5.3f %s::%s", fSeconds,
m_acClassName, acBuffer);
187 fprintf(hFile,
"%s", acOutBuffer);
193 OutputDebugString(acOutBuffer);
195 fprintf(stderr,
"%s",acOutBuffer);
205 const char *pcErrorMessage,...)
const
211 va_start(args, pcErrorMessage);
215 clock_gettime(CLOCK_REALTIME,&nowTimeVal);
216 double fSeconds = (nowTimeVal.tv_sec
218 #elif defined(_WIN32)
221 double fSeconds = (nowTimeVal.time
225 gettimeofday(&nowTimeVal,0);
226 double fSeconds = (nowTimeVal.tv_sec
230 static char acBuffer[255];
231 static char acOutBuffer[300];
232 vsprintf(acBuffer, pcErrorMessage, args);
233 sprintf(acOutBuffer,
"\nERROR: #%i %5.3f %s::%s", iErrorCode, fSeconds,
m_acClassName, acBuffer);
241 fprintf(hFile,
"%s", acOutBuffer);
248 OutputDebugString(acOutBuffer);
250 fprintf(stderr,
"%s", acOutBuffer);
265 va_start(args, pcWarningMessage);
269 clock_gettime(CLOCK_REALTIME,&nowTimeVal);
270 double fSeconds = (nowTimeVal.tv_sec
272 #elif defined(_WIN32)
275 double fSeconds = (nowTimeVal.time
279 gettimeofday(&nowTimeVal,0);
280 double fSeconds = (nowTimeVal.tv_sec
284 static char acBuffer[255];
285 static char acOutBuffer[300];
286 vsprintf(acBuffer, pcWarningMessage, args);
287 sprintf(acOutBuffer,
"\nWARNING: %5.3f %s::%s", fSeconds,
m_acClassName, acBuffer);
288 sprintf(acOutBuffer,
"\nWARNING: %s::%s",
m_acClassName, acBuffer);
295 fprintf(hFile,
"%s", acOutBuffer);
302 OutputDebugString(acOutBuffer);
305 fprintf(stderr,
"%s", acOutBuffer);
317 static char acBuffer[255];
319 va_start(args, pcLoggingMessage);
320 vsprintf(acBuffer, pcLoggingMessage, args);
322 FILE *m_hLogFile=fopen(
"log.txt",
"a+");
323 if(m_hLogFile != NULL)
325 fprintf(m_hLogFile,
"%s",acBuffer);
333 const char *pcDebugMessage,...)
const
344 va_start(args, pcDebugMessage);
348 clock_gettime(CLOCK_REALTIME,&nowTimeVal);
349 double fSeconds = (nowTimeVal.tv_sec
351 #elif defined(_WIN32)
354 double fSeconds = (nowTimeVal.time
358 gettimeofday(&nowTimeVal,0);
359 double fSeconds = (nowTimeVal.tv_sec
363 static char acBuffer[255];
364 static char acOutBuffer[300];
365 vsprintf(acBuffer, pcDebugMessage, args);
366 sprintf(acOutBuffer,
"\nDEBUG: %i %5.3f %s::%s", iDebugLevel, fSeconds,
m_acClassName, acBuffer);
374 fprintf(hFile,
"%s", acOutBuffer);
381 OutputDebugString(acOutBuffer);
385 fprintf(stderr,
"%s", acOutBuffer);