-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogging.h
More file actions
27 lines (26 loc) · 940 Bytes
/
Copy pathLogging.h
File metadata and controls
27 lines (26 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <windows.h>
#include <iostream>
#define APPNAME "FBW"
inline void setConsoleAttribute(DWORD attr){
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(handle,attr);
}
inline std::ostream& red(std::ostream& os){
setConsoleAttribute(FOREGROUND_RED | FOREGROUND_INTENSITY);
return os;
}
inline std::ostream& white(std::ostream& os){
setConsoleAttribute(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
return os;
}
inline std::ostream& green(std::ostream& os){
setConsoleAttribute(FOREGROUND_GREEN | FOREGROUND_INTENSITY);
return os;
}
inline std::ostream& purple(std::ostream& os){
setConsoleAttribute(FOREGROUND_RED | FOREGROUND_BLUE);
return os;
}
#define LOG(x) std::cout << "[" << APPNAME << "]:" << x
#define LOG_ERROR(x) std::cerr << red << "[" << APPNAME << "]:" << x << white
#define LOG_SUCCESS(x) std::cerr << green << "[" << APPNAME << "]:" << x << white