예제 #1
0
파일: Log.cpp 프로젝트: molephill/OpenGL
void CLog::WriteFuncEnd(T x)
{
#ifdef WRITE_LOG_ENABLE
    char szPath[PATH_MAX] = {0};
    GetLogFilePath(szPath);
    ofstream fout(szPath,ios::app);
    fout.seekp(ios::end);
    fout << GetSystemTime() << "--------------------"<< x <<"  End  --------------------" << endl;
    fout.close();
#elseif DEBUG
    std::cout << GetSystemTime() << "--------------------"<< x <<"  End  --------------------" << std::endl;
#endif
}
예제 #2
0
파일: Log.cpp 프로젝트: molephill/OpenGL
void CLog::WriteLog2(T1 x1,T2 x2)
{
#ifdef WRITE_LOG_ENABLE
    char szPath[PATH_MAX] = {0};
    GetLogFilePath(szPath);
    ofstream fout(szPath,ios::app);
    fout.seekp(ios::end);
    fout << GetSystemTime() << x1 <<" = "<< x2 << endl;
    fout.close();
#elseif DEBUG
    std::cout << GetSystemTime() << x1 << "=" << x2 << std::endl;
#endif
}
	ERMsg CBioSIMProject::Execute(const CFileManager& fileManager, CCallback& callback)
	{
		ERMsg msg;

		//callback.PushTask("Main loop over components", GetNbExecute(false));
		msg += ExecuteChild(fileManager, callback);
		//callback.PopTask();

		string logText = GetOutputString(msg, callback, true);
		string filePath = GetLogFilePath(GetPath(fileManager));

		msg += WriteOutputMessage(filePath, logText);

		return msg;
	}
예제 #4
0
파일: Log.cpp 프로젝트: zyy329/Tools
const CLog::SOpenFile* CLog::GetLogFile( EErrorMsg_Type eType )
{
    static SOpenFile* pOpenFile;
    pOpenFile = NULL;

    // 日志文件对象获得
    if ( eType > eERROR_MSG_TYPE_START && eType < eERROR_MSG_TYPE_NUMBERS )
    {
        MapLogFileItr itr = m_mapLogFile.find( eType );

        if ( itr != m_mapLogFile.end() )
        {
            // 获得已打开的日志文件对象
            pOpenFile = &(itr->second);
        }
        else
        {
            // 创建新日志文件对象
            pair<MapLogFileItr, bool> ret = m_mapLogFile.insert( make_pair(eType, SOpenFile()) );
            if ( ret.second == true )
            {
                pOpenFile = &(ret.first->second);
            }
        }
    }

    // 日志文件指针维护
    CTime tempTime = CTime::GetCurrentTime();
    if( pOpenFile != NULL )
    {
        // 日志文件维护
        if ( pOpenFile->pFile == NULL || (pOpenFile->cTime.GetDay() != tempTime.GetDay()) )
        {
            if(pOpenFile->pFile != NULL) fclose(pOpenFile->pFile);

            TString strFliePath;
            GetLogFilePath( eType, strFliePath );
            pOpenFile->pFile = _tfsopen(strFliePath.c_str(), _T("a+t"), _SH_DENYNO);

            if (pOpenFile->pFile != NULL)
            {
                pOpenFile->cTime = tempTime;
            }
        }
    }

    return pOpenFile;
}