bool CMOOSLogger::OnNewMail(MOOSMSG_LIST &NewMail) { //these three calls look through the incoming mail //and handle all appropriate logging DoAsyncLog(NewMail); UpdateMOOSVariables(NewMail); LogSystemMessages(NewMail); //here we look for more unusual things MOOSMSG_LIST::iterator q; for(q=NewMail.begin();q!=NewMail.end();q++) { if(q->IsSkewed(MOOSTime())) continue; //are we being asked to restart? if(MOOSStrCmp(q->GetKey(),"LOGGER_RESTART")) { OnLoggerRestart(); } } return true; }
bool CMOOSRemoteLite::MailLoop() { m_bRunMailLoop = true; while(!m_bQuit) { MOOSPause(300); MOOSMSG_LIST MailIn; if(m_bRunMailLoop && m_Comms.Fetch(MailIn)) { //process mail //simply write out MOOSMSG_LIST::iterator p; //make it in time order MailIn.sort(); MailIn.reverse(); for(p = MailIn.begin();p!=MailIn.end();p++) { if(p->IsSkewed(MOOSTime())) continue; if(MOOSStrCmp(p->m_sKey,"NAV_SUMMARY")) { DoNavSummary(*p); } else if(p->GetKey().find("DEBUG")!=string::npos) { //we print MOOS_DEBUG messages to the screen string sMsg = p->m_sVal; MOOSRemoveChars(sMsg,"\r\n"); MOOSTrace(">%-10s @ %7.2f \"%s\"\n", p->m_sSrc.c_str(), p->m_dfTime-GetAppStartTime(), sMsg.c_str()); } else { CUSTOMJOURNAL_MAP::iterator w = m_CustomJournals.find(p->GetKey()); if(w!=m_CustomJournals.end()) { w->second.Add(p->GetAsString()); } } } UpdateMOOSVariables(MailIn); } } return true; }