19 #include <netinet/in.h>
20 #include <sys/socket.h>
21 #include <sys/types.h>
22 #include <arpa/inet.h>
29 #include <unordered_map>
37 #include <sys/ioctl.h>
40 #include <unordered_set>
45 #include <string_view>
47 #define RESET "\033[0m"
48 #define BLACK "\033[0;30m"
49 #define RED "\033[0;31m"
50 #define GREEN "\033[0;32m"
51 #define YELLOW "\033[0;33m"
52 #define BLUE "\033[0;34m"
53 #define MAGENTA "\033[0;35m"
54 #define CYAN "\033[0;36m"
55 #define WHITE "\033[0;37m"
56 #define LIGHT_GREY "\033[0;37m"
57 #define DARK_GREY "\033[0;90m"
58 #define BOLD "\033[1m"
59 #define ITALIC "\033[3m"
60 #define UNDERLINE "\033[4m"
61 #define BLINK "\033[5m"
62 #define REVERSE "\033[7m"
63 #define HIDDEN "\033[8m"
65 #define UNUSED __attribute__((unused))
67namespace Jetpack::Logs {
84 extern bool debug_mode;
101 Debug(
const std::string file =
"",
const int line = 0,
const std::string func =
"");
115 static void point(
const std::string file,
const int line,
const std::string func);
124 template <
typename T>
128 std::cout << message;
154 Error(
const std::string file =
"",
const int line = 0,
const std::string func =
"");
167 template <
typename T>
169 std::cerr << message;
195 Warning(
const std::string file =
"",
const int line = 0,
const std::string func =
"");
208 template <
typename T>
212 std::cerr << message;
227 #define DEBUG Jetpack::Logs::Debug(__FILE__, __LINE__, __PRETTY_FUNCTION__)
228 #define DEBUG_CONCAT Jetpack::Logs::Debug()
229 #define POINT Jetpack::Logs::Debug::point(__FILE__, __LINE__, __PRETTY_FUNCTION__)
230 #define ERROR Jetpack::Logs::Error(__FILE__, __LINE__, __PRETTY_FUNCTION__)
231 #define WARNING Jetpack::Logs::Warning(__FILE__, __LINE__, __PRETTY_FUNCTION__)
A class for debugging.
Definition Logs.hpp:93
Debug & operator<<(const T &message)
Print a debug message.
Definition Logs.hpp:125
Debug(const std::string file="", const int line=0, const std::string func="")
Constructor of the Debug.
Definition Logs.cpp:41
static void point(const std::string file, const int line, const std::string func)
Print a debug point.
Definition Logs.cpp:76
~Debug()
Destructor of the Debug.
Definition Logs.cpp:63
A class for errors.
Definition Logs.hpp:146
Error & operator<<(const T &message)
Print an error message.
Definition Logs.hpp:168
~Error()
Destructor of the Error.
Definition Logs.cpp:125
Error(const std::string file="", const int line=0, const std::string func="")
Constructor of the Error.
Definition Logs.cpp:108
A class that represents the time.
Definition Logs.hpp:73
static std::string getLocalTime()
Gets the local time.
Definition Logs.cpp:22
A class for warnings.
Definition Logs.hpp:187
Warning & operator<<(const T &message)
Print a warning message.
Definition Logs.hpp:209
~Warning()
Destructor of the Warning.
Definition Logs.cpp:166
Warning(const std::string file="", const int line=0, const std::string func="")
Constructor of the Warning.
Definition Logs.cpp:147