1
0
Fork 0
mirror of https://gitlab.com/niansa/PolicyToolLib.git synced 2025-03-06 20:48:27 +01:00

Only enable logging in debug builds

This commit is contained in:
Nils Sauer 2023-01-18 16:20:55 +01:00
parent cd0ebef412
commit 0043c1b5c9
2 changed files with 11 additions and 1 deletions

View file

@ -21,7 +21,7 @@ static std::ofstream *log_out;
char sDetourLibrary[512];
#ifdef ENABLE_LOGGING
void log_str(std::string_view str) {
*log_out << str;
}
@ -33,6 +33,7 @@ void log_str(std::wstring_view str) {
void log_endl() {
*log_out << "\r\n";
}
#endif
void loadModules() {
char buffer[1000];

9
main.h
View file

@ -1,10 +1,19 @@
#include <string_view>
#ifndef NDEBUG
#define ENABLE_LOGGING
#endif
#define POLICYTOOL_SIZEREQ(x,y) (offsetof(x,y) + sizeof(((x*) NULL)->y))
#define POLICYTOOL_ALIGN(x,y) ((((uintptr_t) (x)) + (((y)/CHAR_BIT)-1)) & ~(((y)/CHAR_BIT)-1))
extern char sDetourLibrary[512];
#ifdef ENABLE_LOGGING
void log_str(std::string_view str);
void log_str(std::wstring_view str);
void log_endl();
#else
#define log_str(...)
#define log_endl()
#endif