Potato Engine
Loading...
Searching...
No Matches
Debug.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include <fstream>
5#include <unordered_map>
6
7class Logger;
8enum class LogType;
9
15extern Logger LOG_DEFAULT;
16
21class Logger
22{
23 const char* LogFilePath;
24
25 std::ofstream LogFile;
26
27public:
28
29 // returns true if successful
30 bool operator () (LogType type, const std::string& message);
31
32 void init(const char* path);
33 ~Logger();
34};
35
36#define logtypes \
37 X(INFO) \
38 X(WARNING) \
39 X(ERROR) \
40 X(VITAL) \
41 X(DEBUG)
42
43#define X(name) name,
44enum class LogType { logtypes };
45#undef X
46
56namespace Debug
57{
58 // construct global Logger objects, bind to log files
65 inline void BindDebugLogs() {
66 LOG_DEFAULT.init("logs/debug.log");
67 }
68}
69
Logger LOG_DEFAULT
Default log object.
Definition Debug.cpp:9
Logging functionality.
Definition Debug.hpp:22
Contains global debug functionality.
Definition Debug.hpp:57
void BindDebugLogs()
Constructs global logger objects, bind to log files.
Definition Debug.hpp:65