void CErrLogMgr::WriteErrLog(CError& exp) { if ( !CatchErrorEnabled() || !ErrLogEnabled() ) { puts(exp.ErrorTitle()); if( exp.ErrorMsg()[0] ) { putchar('\t'); puts(exp.ErrorMsg()); putchar('\n'); } } else { uint64 uCurTime = GetProcessTime(); //如果两次记录log的时间大于interval,我们就要换一个log来记录了 //如果小于这个值,我们仍然使用原来的文件记录 if(uCurTime - m_uLastLogTime > (uint64)m_uInterval) { CErrLogThreadMgr::Inst()->AddCloseErrlogJob(); CreateErrLogFile(); } CErrLogThreadMgr::Inst()->AddWriteErrlogJob(exp,m_strErrInfo.c_str()); m_uLastLogTime = uCurTime; } }
void CErrLogMgr::WriteDumpErrLog(CError& exp) { if ( !CatchErrorEnabled() || !ErrLogEnabled() ) { puts(exp.ErrorTitle()); if( exp.ErrorMsg()[0] ) { putchar('\t'); puts(exp.ErrorMsg()); putchar('\n'); } } else { CErrLog::Inst().WriteErrLog(exp,m_strErrInfo.c_str()); } }