still working on debugs and errors

master
Steffen Pohle 12 hours ago
parent 42b2e69361
commit 686c6569f7

@ -80,8 +80,9 @@ void UDPTCPNetwork_errorexit (char *srcfile, int srcline, char *srcfunc, char *f
void UDPTCPNetwork_enable_debug (int enable); void UDPTCPNetwork_enable_debug (int enable);
#ifndef UDPTCPNETWORK_DISABLE_DEBUG #ifndef UDPTCPNETWORK_DISABLE_DEBUG
#define debug(...) UDPTCPNetwork_debug ((char*)__FILE__, __LINE__, (char*)__FUNCTION__, (char*)__VA_ARGS__) #define debug(...) UDPTCPNetwork_debug (0, (char*)__FILE__, __LINE__, (char*)__FUNCTION__, (char*)__VA_ARGS__)
#define errorexit(...) UDPTCPNetwork_errorexit ((char*)__FILE__, __LINE__, (char*)__FUNCTION__, (char*)__VA_ARGS__) #define debugerror(...) UDPTCPNetwork_debug (0, (char*)__FILE__, __LINE__, (char*)__FUNCTION__, (char*)__VA_ARGS__)
#define errorexit(...) UDPTCPNetwork_errorexit (1, (char*)__FILE__, __LINE__, (char*)__FUNCTION__, (char*)__VA_ARGS__)
#define debug_enable(enable) UDPTCPNetwork_enable_debug (enable) #define debug_enable(enable) UDPTCPNetwork_enable_debug (enable)
#endif #endif

@ -105,7 +105,7 @@ void UDPTCPNetwork_debug_set_logfile(std::string fname) {
#define LEN_TEXT 256 #define LEN_TEXT 256
#define DEBUG_TEXT1LEN 4096 #define DEBUG_TEXT1LEN 4096
#define DEBUG_TEXT2LEN (DEBUG_TEXT1LEN+LEN_TEXT) #define DEBUG_TEXT2LEN (DEBUG_TEXT1LEN+LEN_TEXT)
void UDPTCPNetwork_debug (char *srcfile, int srcline, char *srcfunc, char *fmt,...) { void UDPTCPNetwork_debug (int force, char *srcfile, int srcline, char *srcfunc, char *fmt,...) {
va_list args; va_list args;
char texttime[LEN_TEXT]; char texttime[LEN_TEXT];
char text1[DEBUG_TEXT1LEN]; char text1[DEBUG_TEXT1LEN];
@ -116,7 +116,7 @@ void UDPTCPNetwork_debug (char *srcfile, int srcline, char *srcfunc, char *fmt,.
struct tm tmp; struct tm tmp;
struct tm *tmptr = NULL; struct tm *tmptr = NULL;
if (debug_enabeld == 0) return; if (debug_enabeld == 0 && force == 0) return;
va_start (args, fmt); va_start (args, fmt);
vsnprintf (text1, (DEBUG_TEXT1LEN-1), fmt, args); vsnprintf (text1, (DEBUG_TEXT1LEN-1), fmt, args);
@ -155,7 +155,7 @@ void UDPTCPNetwork_errorexit (char *srcfile, int srcline, char *srcfunc, char *f
va_list args; va_list args;
va_start (args, fmt); va_start (args, fmt);
UDPTCPNetwork_debug (srcfile, srcline, srcfunc, fmt, args); UDPTCPNetwork_debug (1, srcfile, srcline, srcfunc, fmt, args);
va_end (args); va_end (args);
exit (1); exit (1);

Loading…
Cancel
Save