#include <stdio.h>
#include "errorlog.h"
#include "debug.h"

#ifdef LOG
#include "alarmmgr.h"
AlarmManager *ErrorLog::_pAM = AlarmManager::instance();
#endif

// Constructor. Initialize error flag to FALSE, and 
// copy AlarmMgr pointer
ErrorLog::ErrorLog() 
{	
#ifdef LOG
   _pAM = AlarmManager::instance();
#endif
}
// Log error message to file
void ErrorLog::logError(const char *msg)
{
	char fmsg[128];
#ifdef LOG
	if(msg != 0) {
		sprintf(fmsg,"ERROR: %s",msg);
		Alarm::create(fmsg);
	}
#endif
	DPRINTF("%s\n", fmsg);		
}
// Log ErrorLog as an application message
void ErrorLog::logMsg(const char *msg)
{
#ifdef LOG
	if(msg != 0){
		Alarm::create((char *)msg);
	}
#endif
	DPRINTF("%s\n", msg);	
}

