/*
	WinSTon

	Error Log file

	When WinSTon runs, it outputs text to the error log file to show if the system initialised
	correctly. Using this file output we can also list which video modes are present under
	DirectDraw and such like.
*/

#include "..\includes\winston.h"
#include "..\includes\debug.h"

static ofstream errlog;

//-----------------------------------------------------------------------
/*
	Create error log file
*/
void ErrLog_OpenFile(void)
{
	char szString[MAX_FILENAME_LENGTH];

	sprintf(szString,"%s\\errlog.txt",szWorkingDir);
	errlog.open(szString);
}

//-----------------------------------------------------------------------
/*
	Close error log file
*/
void ErrLog_CloseFile(void)
{
	errlog.close();
}

//-----------------------------------------------------------------------
/*
	Output string to error log file
*/
void ErrLog_File(char *format, ...)
{
	char szBuffer[1024];
	va_list argptr;

	va_start(argptr, format);
	vsprintf(szBuffer, format, argptr);
	va_end(argptr);

	errlog << szBuffer;
}
