feat!: rework header files

This commit is contained in:
2026-01-06 20:07:44 +01:00
parent f4f9f4a7ac
commit 66761b8e5d
12 changed files with 122 additions and 78 deletions

53
inc/core/logger.hpp Normal file
View File

@@ -0,0 +1,53 @@
#ifndef LOGGER_HPP
#define LOGGER_HPP
#include <iostream>
// log file
namespace core::log
{
enum Type
{
INFO,
ERROR,
WARNING
};
static inline const char *getErrorType(Type type)
{
switch (type)
{
case INFO:
return "INFO";
case ERROR:
return "ERROR";
case WARNING:
return "WARNING";
}
return "UNKNOWN";
}
inline void log(Type type, const char *desc, int errortype = 0)
{
std::cerr << getErrorType(type) << " ERROR"
<< ((errortype) ? std::format("({})", errortype) : "") << ": "
<< desc << std::endl;
}
inline void info(const char *desc, int codeerror = 0)
{
log(Type::INFO, desc, codeerror);
}
inline void error(const char *desc, int codeerror = 0)
{
log(Type::ERROR, desc, codeerror);
}
inline void warning(const char *desc, int codeerror = 0)
{
log(Type::WARNING, desc, codeerror);
}
}; // namespace core::log
#endif // LOGGER_HPP