CardGame
Rogue-like card videogame
Loading...
Searching...
No Matches
debug.h
Go to the documentation of this file.
1#ifndef DEBUG_H
2#define DEBUG_H
3
4#include <filesystem>
5#include <fstream>
6#include <iostream>
7
8// Debug logic for debug builds
9
10#ifdef CARDGAME_DEBUG
11
12#define DEBUG_LOG(msg) \
13 do \
14 { \
15 std::cerr << "[DEBUG] " << msg << std::endl; \
16 } while (0)
17
18#else
19
20#define DEBUG_LOG(msg) \
21 do \
22 { \
23 static std::ofstream logFile("cardgame_log.txt", std::ios::out | std::ios::app); \
24 if (logFile.is_open()) \
25 { \
26 logFile << "[LOG] " << std::filesystem::path(__FILE__).filename().string() << ":" \
27 << __LINE__ << " " << msg << std::endl; \
28 } \
29 } while (0)
30
31#endif
32
33#endif // DEBUG_H