VEX Engine
Retro looking game engine made in vulkan mostly because i wanted to understand it better.
Loading...
Searching...
No Matches
ErrorUtils.hpp
1
6
7 #pragma once
8 #include <stdexcept>
9 #include <string>
10
11 #ifdef _WIN32
12 #define WIN32_LEAN_AND_MEAN
13 #define NOMINMAX
14 #include <windows.h>
15
16 #ifdef ERROR
17 #undef ERROR
18 #endif
19 #endif
20
21#include <vector>
22 #include "VEX/VEX_export.h"
23
24 namespace vex {
25
27 enum class LogLevel {
28 INFO,
29 WARNING,
30 ERROR,
31 CRITICAL
32 };
33
35 typedef void (*LogCallbackFn)(LogLevel level, const char* message);
36
39 void VEX_EXPORT AddLogCallback(LogCallbackFn callback);
40
47 void VEX_EXPORT InitCrashHandler();
48
57 [[noreturn]] void VEX_EXPORT throw_error(const std::string& msg);
58
69 void VEX_EXPORT log(const char* fmt, ...);
70
77 void VEX_EXPORT log(LogLevel level, const char* fmt, ...);
78
91 void VEX_EXPORT handle_exception(const std::exception& e);
92
105 void VEX_EXPORT handle_critical_exception(const std::exception& e);
106
107 }
void(* LogCallbackFn)(LogLevel level, const char *message)
Defines the callback signature.
void VEX_EXPORT AddLogCallback(LogCallbackFn callback)
Adds a callback function to be called when a log message is generated.
void VEX_EXPORT InitCrashHandler()
Initializes the low-level crash handler.
void VEX_EXPORT throw_error(const std::string &msg)
Throws an error or terminates the application.
void VEX_EXPORT log(const char *fmt,...)
Logs a formatted message.
void VEX_EXPORT handle_critical_exception(const std::exception &e)
Handles a critical exception, forcing termination.
void VEX_EXPORT handle_exception(const std::exception &e)
Handles an exception based on build configuration.
LogLevel
Enum class for log levels.