#pragma once
#include <cstdint>

#define LOG(fmt, ...) Log(ELogType::Log, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define LOG_WARN(fmt, ...) Log(ELogType::Warn, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define LOG_ERROR(fmt, ...) Log(ELogType::Error, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define LOG_ONCE(fmt, ...)                                                                                             \
    if (!WasLogged(ELogType::Log, __FILE__, __LINE__, fmt))                                                            \
    {                                                                                                                  \
        Log(ELogType::Log, __FILE__, __LINE__, fmt, ##__VA_ARGS__);                                                    \
    }
#define WARN_ONCE(fmt, ...)                                                                                            \
    if (!WasLogged(ELogType::Warn, __FILE__, __LINE__, fmt))                                                           \
    {                                                                                                                  \
        Log(ELogType::Warn, __FILE__, __LINE__, fmt, ##__VA_ARGS__);                                                   \
    }
#define ERROR_ONCE(fmt, ...)                                                                                           \
    if (!WasLogged(ELogType::Error, __FILE__, __LINE__, fmt))                                                          \
    {                                                                                                                  \
        Log(ELogType::Error, __FILE__, __LINE__, fmt, ##__VA_ARGS__);                                                  \
    }

enum class ELogType
{
    Log,
    Warn,
    Error,
};

void Log(ELogType logType, const char* file, uint32_t line, const char* format, ...);
bool WasLogged(ELogType logType, const char* file, uint32_t line, const char* format);
