re-enable logging if debug build
| | |
| | | static void getLogFname(char* logpath) { |
| | | #ifdef __unix__ |
| | | const char *folder = getenv("TMPDIR"); |
| | | if (folder == 0) { |
| | | if (folder == nullptr) { |
| | | folder = "/tmp"; |
| | | } |
| | | strncpy(logpath, folder, MAX_PATH); |
| | |
| | | getLogFname(logpath); |
| | | logFile = fopen(logpath, "a"); |
| | | if (logFile == NULL) { |
| | | //what shall we do here? |
| | | return; |
| | | } |
| | | } |
| | |
| | | #ifdef __cplusplus |
| | | extern "C" { |
| | | #endif |
| | | #define LOG_DISABLED 1 |
| | | //#define LOG_DISABLED 1 |
| | | |
| | | #ifndef LOG_DISABLED |
| | | #include <errno.h> |
| | |
| | | |
| | | #define clean_errno() (errno == 0 ? "None" : strerror(errno)) |
| | | |
| | | #ifdef _DEBUG |
| | | #ifndef NDEBUG |
| | | #define LOG_DEBUG(M, ...) _log("[DEBUG] (%s:%d) " M "\n", __FILE__, __LINE__, ##__VA_ARGS__) |
| | | #else |
| | | #define LOG_DEBUG(M,...) |