#include <stdarg.h>
#include <stdio.h>
#include "Log.h"
#include "NdtsError.h"
#include "Errors.h"

namespace NDTS
{
	namespace SCO
	{
	Log::Log(void)
	{
	}

	Log::~Log(void)
	{
	}

	void Log::addGeneralErrorMessage(const char *msg, ...)
	{
		SCO_HandleSCOErrorWithLogLevel(SCO_GeneralError, NDTS_LLDebug);

		const int NOTE_BUFFER_SIZE = 1000;
		va_list arg;
		char note[NOTE_BUFFER_SIZE];
		va_start(arg,msg);
		_vsnprintf(note, NOTE_BUFFER_SIZE - 1, msg, arg);
		va_end(arg);
		NDTS_LogLine(NDTS_LLErr, note);
	}
	
	void Log::addMessageToLog(NDTS_LogLevel level, const char *msg, ...)
	{
		const int NOTE_BUFFER_SIZE = 1000;
		va_list arg;
		char note[NOTE_BUFFER_SIZE];
		va_start(arg,msg);
		_vsnprintf(note, NOTE_BUFFER_SIZE - 1, msg, arg);
		va_end(arg);
		NDTS_LogLine(level, note);
	}

	void Log::addError(SCO_ReturnCode errorNumber, NDTS_LogLevel level )
	{
		SCO_HandleSCOErrorWithLogLevel(errorNumber, level);
	}
}}
