Class CFileLog::
WriteLog()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: SetMaxLogSizeNext page: WriteMessage    Show member index
Public Function Declared in:
FileLog.h

'Declaration' icon -- Shortcut to top of page. Declaration

void WriteLog(
    const std::string& rClass,
    const std::string& rMethod,
    const std::string& rMessage,
    CErrorHandler::LogPriority aPriority);

'Description' icon -- Shortcut to top of page. Description

Write to log, thread safe

'Function Body' icon -- Shortcut to top of page. 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' icon -- Shortcut to top of page. See Also

Class Overview Class Overview  |  Public base class CErrorHandler::CErrorLog  |  Hierarchy Chart Hierarchy Chart


Get Surveyor!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.