#pragma once

#include <MSFS\Legacy\gauges.h>

#include <stdio.h>

namespace khofmann
{
	static FILE* logFile;

	/// <summary>
	/// Write to logfile and console
	/// </summary>
	/// <param name="stream">Console stream</param>
	/// <param name="format">Format string wiht up to one specifier</param>
	/// <param name="optionalElement">Optional element specified by specifier</param>
	static void log(FILE* stream, const char* format, void* optionalElement = NULL)
	{
		if (logFile != NULL)
		{
			fprintf(logFile, format, optionalElement);
			fflush(logFile);
		}
		fprintf(stream, format, optionalElement);
	}
}
