Initial Gitea Commit

This commit is contained in:
onTheZero
2026-01-05 10:36:27 -05:00
parent 5b32d32b0b
commit fa7ae9ac1c
19 changed files with 1372 additions and 288 deletions

View File

@@ -1,29 +1,59 @@
#pragma once
#include <iostream>
#include <string>
#include <source_location>
#include <format>
#include <stdexcept>
enum LogLevel {
INFO,
WARNING,
ERROR
};
namespace Log
{
void log(LogLevel level, const std::string& message) {
std::string levelStr;
enum class Level
{
Info,
Warning,
Error,
Debug,
VkValidation,
DeviceSetup
};
switch(level) {
case INFO:
levelStr = "[INFO]";
break;
case WARNING:
levelStr = "[WARNING]";
break;
case ERROR:
levelStr = "[ERROR]";
break;
default:
levelStr = "[UNKNOWN]";
break;
// void Message(Level Level, const std::source_location& Location = std::source_location::current(), const std::string& Message);
void Message(Level Level, const std::string& Message, const std::source_location& Location);
template <typename... Args>
void Info(const std::string& Format, Args&&... Arguments, const std::source_location& Location = std::source_location::current())
{
Message(Level::Info, std::vformat(Format, std::make_format_args(Arguments...)), Location);
}
std::cout << levelStr << " : " << message << std::endl;
}
template <typename... Args>
void Warning(const std::string& Format, Args&&... Arguments, const std::source_location& Location = std::source_location::current())
{
Message(Level::Warning, std::vformat(Format, std::make_format_args(Arguments...)), Location);
}
template <typename... Args>
void Error(const std::string& Format, Args&&... Arguments, const std::source_location& Location = std::source_location::current())
{
Message(Level::Error, std::vformat(Format, std::make_format_args(Arguments...)), Location);
}
template <typename... Args>
void Debug(const std::string& Format, Args&&... Arguments, const std::source_location& Location = std::source_location::current())
{
Message(Level::Warning, std::vformat(Format, std::make_format_args(Arguments...)), Location);
}
template <typename... Args>
void Validation(const std::string& Format, Args&&... Arguments, const std::source_location& Location = std::source_location::current())
{
Message(Level::VkValidation, std::vformat(Format, std::make_format_args(Arguments...)), Location);
}
template <typename... Args>
void DeviceSetup(const std::string& Format, Args&&... Arguments, const std::source_location& Location = std::source_location::current())
{
Message(Level::DeviceSetup, std::vformat(Format, std::make_format_args(Arguments...)), Location);
}
} // namespace Log