Potato Engine
Toggle main menu visibility
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
7
class
Logger
;
8
enum class
LogType;
9
15
extern
Logger
LOG_DEFAULT
;
16
21
class
Logger
22
{
23
const
char
* LogFilePath;
24
25
std::ofstream LogFile;
26
27
public
:
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,
44
enum class
LogType { logtypes };
45
#undef X
46
56
namespace
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
LOG_DEFAULT
Logger LOG_DEFAULT
Default log object.
Definition
Debug.cpp:9
Logger
Logging functionality.
Definition
Debug.hpp:22
Debug
Contains global debug functionality.
Definition
Debug.hpp:57
Debug::BindDebugLogs
void BindDebugLogs()
Constructs global logger objects, bind to log files.
Definition
Debug.hpp:65
Debug
Debug.hpp
Generated by
1.17.0