Files

50 lines
1.0 KiB
C++
Raw Permalink Normal View History

2025-03-14 19:32:40 +01:00
#pragma once
#include <string>
2025-10-07 17:11:43 +02:00
#ifdef _WIN32
2025-09-26 21:09:51 +02:00
#define __PRETTY_FUNCTION__ __FUNCTION__
#endif
2025-03-14 19:32:40 +01:00
namespace pixelarium::utils::log
{
2025-06-13 22:23:20 +00:00
enum class LogLevel
{
2025-10-07 12:18:00 +02:00
kTrace = 1 << 0,
kDebug = 1 << 1,
kInfo = 1 << 2,
kWarn = 1 << 3,
kError = 1 << 4,
2025-06-13 22:23:20 +00:00
};
constexpr auto LogLevelToString(LogLevel lvl) -> std::string
{
switch (lvl)
{
case LogLevel::kTrace:
return "Trace";
case LogLevel::kDebug:
return "Debug";
case LogLevel::kInfo:
return "Info";
case LogLevel::kWarn:
return "Warning";
case LogLevel::kError:
return "Error";
}
}
2025-09-26 21:09:51 +02:00
/// @brief Interface for logging implementations.
2025-03-14 19:32:40 +01:00
class ILog
{
public:
2025-08-18 22:39:43 +00:00
virtual void Info(const std::string& msg) const = 0;
virtual void Debug(const std::string& msg) const = 0;
virtual void Warn(const std::string& msg) const = 0;
virtual void Error(const std::string& msg) const = 0;
virtual void ChangeLevel(LogLevel lvl) const = 0;
2025-03-14 19:32:40 +01:00
virtual ~ILog() {}
};
2025-06-13 22:23:20 +00:00
} // namespace pixelarium::utils::log