#include <stdarg.h>
#include "logger.h"

FILE *Logger::mLogFile = NULL;

bool Logger::Init(const char *filename)
{
	if (Logger::mLogFile)
		fclose(mLogFile);

	Logger::mLogFile = fopen(filename, "w");

	return (Logger::mLogFile != NULL);
}

int Logger::Printf(const char *format, ...)
{
	if (!Logger::mLogFile)
		return 0;

	va_list argptr;
	va_start(argptr, format);

	return vfprintf_s(mLogFile, format, argptr);
}