Game

Debug Utilities

Logging, crash handling, runtime flags, and diagnostics in Nevo projects.

DebugManager Setup

Initialize logging near the start of main.cpp:

#include <debug/DebugManager.hpp>

Public::Debug::DebugManager::getInstance().Initialize("game.log");
Public::Debug::DebugManager::getInstance().EnableConsoleOutput(true);
Public::Debug::DebugManager::getInstance().SetMinLogLevel(
    Public::Debug::DebugManager::LogLevel::Verbose
);

Logs are written to the configured folder. Nevo-base uses game.log.

Log Macros

Use the macros for normal game and engine diagnostics:

LOG_VERBOSE("Detailed system update trace");
LOG_INFO("Scene loaded");
LOG_ASSERT("Developer checkpoint reached");
LOG_WARNING("Texture missing, using fallback");
LOG_ERROR("Failed to load material");
LOG_CRITICAL("Fatal initialization failure");
LevelUse
VerboseHigh-frequency or detailed debugging.
InfoNormal milestones.
AssertHigh-visibility developer checkpoints.
WarningRecoverable suspicious state.
ErrorOperation failed but the app can continue.
CriticalSevere failure or crash-adjacent state.

Crash Handling

The public debug headers include helpers for platform crash reporting. Nevo-base/src/main.cpp sets an unhandled exception filter on Windows and signal handlers on Linux.

Windows pattern:

#ifdef _WIN32
#include <Windows.h>

LONG WINAPI UnhandledExceptionHandler(EXCEPTION_POINTERS* exceptionInfo) {
    DWORD code = exceptionInfo ? exceptionInfo->ExceptionRecord->ExceptionCode : 0;
    Public::Debug::DebugManager::getInstance().UnhandledExceptionHandler(
        "Unhandled exception: code " + std::to_string(code)
    );
    return EXCEPTION_EXECUTE_HANDLER;
}
#endif

Then install it before engine initialization:

#ifdef _WIN32
SetUnhandledExceptionFilter(UnhandledExceptionHandler);
#endif

Runtime Flags

Pass command-line flags into the engine flag manager:

auto& engine = Public::Engine::getInstance();
engine.GetFlagManager().passFlags(argc, argv);

if (ISFLAG("--flagManTest")) {
    LOG_ASSERT("Flag manager test passed.");
}

The helper macros are defined in EngineExports.hpp:

ISFLAG("--name")
FLAGVALUE("--name")

FLAGVALUE returns std::optional<std::string>.

System Information and Crash Context

Public debug helpers include:

HeaderPurpose
<debug/SystemInfoManager.hpp>OS, GPU, CPU, and RAM details.
<debug/PlatformCrashHandler.hpp>Stacktrace, memory info, modules, threads, process snapshot.
<debug/Dx12CrashDiagnostics.hpp>DRED-style DX12 crash reports where available.
<debug/CrashDumpProviders.hpp>Register providers for scene state and other dump text.

Use these when adding engine-level diagnostics or richer crash reports. Gameplay code usually only needs DebugManager and the log macros.