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

#pragma once

#include "glmLog.h"

namespace glm
{
	// Format the log messages and pass them as arguments to a callback

	typedef void(*logCallback)(const char* msg, void* userData);

	struct LogCallback
	{
		logCallback _callback;
		void* _userData;
	};

	class GLM_CORE_API CallbackLogger : public ILogger
	{
	public:
		CallbackLogger();
		virtual ~CallbackLogger(){}

		void registerCallback(logCallback callback, void* userData);
		virtual void trace(Log::Module module, Log::Severity severity, const char* msg, const char* file, int line, const char* operation);

	private:

		LogCallback _logCallback;
	};

	//-------------------------------------------------------------------------
	inline void CallbackLogger::registerCallback(logCallback callback, void* userData)
	{
		_logCallback._callback = callback;
		_logCallback._userData = userData;
	}
}
