![]() |
WriteLog() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| Public Function |
Declared in: FileLog.h |
Declaration
void WriteLog(
const std::string& rClass,
const std::string& rMethod,
const std::string& rMessage,
CErrorHandler::LogPriority aPriority);
DescriptionWrite to log, thread safe
Function Body
try
{
#ifdef _DEBUG
m_aLog.WriteLog(rClass,
rMethod,
rMessage,
aPriority);
#endif
//Our error string
std::string sPrefix;
//Our string to print
switch (aPriority)
{
case CErrorHandler::lpMessage:
sPrefix="***MESSAGE*** ";
break;
case CErrorHandler::lpCritical:
sPrefix="***CRITICAL*** ";
break;
case CErrorHandler::lpError:
sPrefix="***ERROR*** ";
break;
}
//Lock it
CCriticalAutoRelease aRelease(m_pCSection);
//Do we have a prefix
if (!sPrefix.empty())
fprintf(m_pFile,"%s",sPrefix.c_str());
//First write time
char tmpbuf[128];
//Get data
_strdate(tmpbuf);
fprintf(m_pFile,"%s ",tmpbuf);
_strtime(tmpbuf);
fprintf(m_pFile,"%s: ",tmpbuf);
//Write to log
fprintf(m_pFile,"%s, %s, %s\n",rClass.c_str(),
rMethod.c_str(),
rMessage.c_str());
//If error, or auto flush - then flush the data
if (aPriority==CErrorHandler::lpError ||
GetAutoFlush())
fflush(m_pFile);
}
ERROR_UNKNOWN("WriteLog")
See Also
This web site was generated
using Surveyor V4.50.811.1. Click
here
for more information. |
Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003. |