/***************************************************************************
*                                                                          *
*  Copyright (C) Golaem S.A.  All Rights Reserved.                         *
*                                                                          *
****************************************************************************/

#pragma once

#include <fstream>
#include "glmLog.h"

// appends log messages to a log file.
namespace glm
{
	class GLM_CORE_API FileLogger: public ILogger
	{
	public:

		enum OutputMode
		{
			APP, // all output operations happen at the end of the file, appending to its existing contents
			TRUNC // any contents that existed in the file before it is open are discarded
		};

		enum FlushMode
		{
			FLUSH, // synchronous write to file
			NO_FLUSH // asynchronous write to file
		};

		FileLogger(const char* file, OutputMode outputMode = TRUNC, FlushMode flushMode = NO_FLUSH);
		virtual ~FileLogger();
		virtual void trace(Log::Module module, Log::Severity severity, const char* msg, const char* file, int line, const char* operation);

	private:


#ifdef _MSC_VER
#	pragma warning( push )
#	pragma warning( disable : 4251)
#endif
		std::ofstream _fileStream;

#ifdef _MSC_VER
#	pragma warning( pop )
#endif
	
		FlushMode _flushMode;
	};
}
