#ifndef OpenTestSystem_OtxDiagManager_Common_DefaultLogger_H
#define OpenTestSystem_OtxDiagManager_Common_DefaultLogger_H

#include "CommonDefs.h"

#include "ILogger.h"

#include <string>
#include <memory>

namespace spdlog
{
	class logger;
}

namespace OpenTestSystem
{
	namespace OtxDiagManager
	{
		/// <summary>
		/// Namespace containing all common methods for the DiagManager
		/// </summary>
		namespace Common
		{
			/// <summary>
			/// DiagManager default logger
			/// </summary>
			class COMMON_EXPORTS DefaultLogger :
				public ILogger
			{
			public:
				DefaultLogger();
				DefaultLogger(const std::string &path);
				virtual ~DefaultLogger();
				/// <summary>
				/// Sets the log level
				/// </summary>
				/// <param name="module"></param>
				/// <param name="text"></param>
				void Log(const std::string& module, const std::string& text) override;
				/// <summary>
				/// Sets the log file destination
				/// </summary>
				/// <param name="path">Path name of the log file, e.g. 'C://'</param>
				/// <param name="filename">Filename of the log file, e.g. 'OtxDiagManagerSample.log'</param>
				void SetFile(const std::string &path, const std::string &filename);
				/// <summary>
				/// Sets the default logger instance statically
				/// </summary>
				static void Set(ILogger*);
				/// <summary>
				/// Gets the default logger instance
				/// </summary>
				/// <returns>The default logger instance</returns>
				static ILogger* Get();

			protected:
				void SetupDailyLogger();

			private:
				std::string _path;
				std::string _filename;
				std::shared_ptr<spdlog::logger> _spdLogger;
			};
		}
	}
}
#endif // OpenTestSystem_OtxDiagManager_Common_DefaultLogger_H
