Update Log.h
This commit is contained in:
parent
c041a4e348
commit
6003db8562
1 changed files with 36 additions and 5 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <format>
|
||||||
|
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
|
||||||
|
@ -24,14 +25,44 @@ public:
|
||||||
void LogError(const std::string& message);
|
void LogError(const std::string& message);
|
||||||
void LogFatal(const std::string& message);
|
void LogFatal(const std::string& message);
|
||||||
|
|
||||||
|
template<typename... Args>
|
||||||
|
void LogTrace(std::format_string<Args...> fmt, Args&&... args)
|
||||||
|
{
|
||||||
|
LogTrace(std::format(fmt, std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename... Args>
|
||||||
|
void LogInfo(std::format_string<Args...> fmt, Args&&... args)
|
||||||
|
{
|
||||||
|
LogInfo(std::format(fmt, std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename... Args>
|
||||||
|
void LogWarn(std::format_string<Args...> fmt, Args&&... args)
|
||||||
|
{
|
||||||
|
LogWarn(std::format(fmt, std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename... Args>
|
||||||
|
void LogError(std::format_string<Args...> fmt, Args&&... args)
|
||||||
|
{
|
||||||
|
LogError(std::format(fmt, std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename... Args>
|
||||||
|
void LogFatal(std::format_string<Args...> fmt, Args&&... args)
|
||||||
|
{
|
||||||
|
LogFatal(std::format(fmt, std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
spdlog::logger* GetLogger() const;
|
spdlog::logger* GetLogger() const;
|
||||||
|
|
||||||
LoggerImpl& _impl;
|
LoggerImpl& _impl;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LOG_TRACE(message) ::FluxEngine::GetLogger()->LogTrace(message)
|
#define LOG_TRACE(...) ::FluxEngine::GetLogger()->LogTrace(__VA_ARGS__)
|
||||||
#define LOG_INFO(message) ::FluxEngine::GetLogger()->LogInfo(message)
|
#define LOG_INFO(...) ::FluxEngine::GetLogger()->LogInfo (__VA_ARGS__)
|
||||||
#define LOG_WARN(message) ::FluxEngine::GetLogger()->LogWarn(message)
|
#define LOG_WARN(...) ::FluxEngine::GetLogger()->LogWarn (__VA_ARGS__)
|
||||||
#define LOG_ERROR(message) ::FluxEngine::GetLogger()->LogError(message)
|
#define LOG_ERROR(...) ::FluxEngine::GetLogger()->LogError(__VA_ARGS__)
|
||||||
#define LOG_FATAL(message) ::FluxEngine::GetLogger()->LogFatal(message)
|
#define LOG_FATAL(...) ::FluxEngine::GetLogger()->LogFatal(__VA_ARGS__)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue