// ShortFrame6.cc // // Tests separateTime() and separateEpilogue() functions // // Runs through all severities // #include "ErrorLogger/ELadministrator.h" #include "ErrorLogger/ELdestControl.h" #include "ErrorLogger/ELoutput.h" #include "ErrorLogger/ELstatistics.h" #include "ErrorLogger/ErrorObj.h" #include "ErrorLogger/ELstring.h" #include "ErrorLogger/ELseverityLevel.h" ZM_USING_NAMESPACE( zmel ) #include "ShortFrame6.h" #include "SampleEvent.h" #include "ShortModule.h" #include "ZMutility/iostream" USING( std::cout ) USING( std::endl ) int main() { ShortFrame6 framework; framework.SetupAndRun(); return 0; } ShortFrame6::ShortFrame6(){ step = new ShortModule("Short"); } ShortFrame6::~ShortFrame6(){ delete step; } void ShortFrame6::SetupAndRun(){ logger = ELadministrator::instance(); logger->setAbortThreshold(ELhighestSeverity); output = logger->attach(ELoutput(cout)); logfile = logger->attach(ELoutput("separateTime.log")); stats = logger->attach(ELstatistics(cout)); logfile.separateTime(); // $$ 24:7 logfile.separateEpilogue(); // $$ 24:7 logfile.includeSerial(); // $$ 24:7 cout << "ELsuccess's symbol " << ELsuccess.getSymbol() << endl; // $$ 8:1 cout << "ELsuccess's name " << ELsuccess.getName() << endl; errlog (ELsuccess, "Starting up.") << endmsg; logfile.suppressTime(); //Run though of all severity levels- The logfile should contain none $$ 8:3 //of these logs (except ELhighestSev) because its threshold is always //1 severity level above the logged message. The output(cout) should //contain all of these logs because its threshold is 1 below. //Default threshold on ELdestControls is ELzeroSeverity. logfile.setThreshold(ELincidental); errlog (ELzeroSeverity, "ELzeroSeverity") << endmsg; logfile.setThreshold(ELsuccess); errlog (ELincidental, "ELincidental") << endmsg; output.setThreshold(ELincidental); logfile.setThreshold(ELinfo); errlog (ELsuccess, "ELsuccess") << endmsg; output.setThreshold(ELsuccess); logfile.setThreshold(ELwarning); errlog (ELinfo, "ELinfo") << endmsg; output.setThreshold(ELinfo); logfile.setThreshold(ELwarning2); errlog (ELwarning, "ELwarning") << endmsg; output.setThreshold(ELwarning); logfile.setThreshold(ELerror); errlog (ELwarning2, "ELwarning2") << endmsg; output.setThreshold(ELwarning2); logfile.setThreshold(ELerror2); errlog (ELerror, "ELerror") << endmsg; output.setThreshold(ELerror); logfile.setThreshold(ELnextEvent); errlog (ELerror2, "ELerror2") << endmsg; output.setThreshold(ELerror2); logfile.setThreshold(ELunspecified); errlog (ELnextEvent, "ELnextEvent") << endmsg; output.setThreshold(ELnextEvent); logfile.setThreshold(ELsevere); errlog (ELunspecified, "ELunspecified") << endmsg; output.setThreshold(ELunspecified); logfile.setThreshold(ELsevere2); errlog (ELsevere, "ELsevere") << endmsg; output.setThreshold(ELsevere); logfile.setThreshold(ELabort); errlog (ELsevere2, "ELsevere2") << endmsg; output.setThreshold(ELsevere2); logfile.setThreshold(ELfatal); errlog (ELabort, "ELabort") << endmsg; output.setThreshold(ELabort); logfile.setThreshold(ELhighestSeverity); errlog (ELfatal, "ELfatal") << endmsg; output.setThreshold(ELfatal); errlog (ELhighestSeverity, "ELhighestSeverity") << endmsg; //end of run though logfile.includeTime(); logger->wipe(); logger->setThresholds(ELzeroSeverity); logger->setLimits("*", 9); logger->setTimespans("Timespan of 5", 5); // $$ 20:4 errlog(ELinfo, "Separator") << "\n\n" << endmsg; //prints out 9 ELwarning2's unless user waits more than 5 seconds for (int i=0; i<17; i++) { if(i==9) { Pause(); } errlog(ELwarning2, "Timespan of 5") << endmsg; } errlog(ELinfo, "Separator") << "\n\n" << endmsg; logfile.setTimespan(ELerror2, 5); // $$ 20:2 output.setTimespan("*", 10); // $$ 20:3 for (int i=0; i<17; i++) { if (i==9) { Pause(); } errlog(ELnextEvent, "Timespan of 5,10") << endmsg; errlog(ELerror2, "Error2") << endmsg; } errlog.setModule("Module Name"); errlog.setSubroutine("Subroutine Name"); errlog(ELzeroSeverity, "Finished module.") << endmsg; } void Pause(){ int blah; cout << "Pausing... Please enter an integer to continue: "; std::cin >> blah; } #include "ShortModule.cc"