|
|
|
|
@ -13,7 +13,6 @@ using namespace std;
|
|
|
|
|
|
|
|
|
|
char dnsip[NET_HOSTLEN];
|
|
|
|
|
int UDPTCPNetwork_init = 0;
|
|
|
|
|
std::string debug_file = "";
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// convert host and port to sockaddr_in6
|
|
|
|
|
@ -96,13 +95,8 @@ std::string string_to_lower(std::string s) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void debug_set_logfile(std::string fname) {
|
|
|
|
|
debug_file = fname;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define LEN_TEXT 256
|
|
|
|
|
#define DEBUG_TEXT1LEN 4096
|
|
|
|
|
#define LEN_TEXT 128
|
|
|
|
|
#define DEBUG_TEXT1LEN 2048
|
|
|
|
|
#define DEBUG_TEXT2LEN (DEBUG_TEXT1LEN+LEN_TEXT)
|
|
|
|
|
void _debug (char *srcfile, int srcline, char *srcfunc, char *fmt,...) {
|
|
|
|
|
va_list args;
|
|
|
|
|
@ -127,19 +121,20 @@ void _debug (char *srcfile, int srcline, char *srcfunc, char *fmt,...) {
|
|
|
|
|
if (tmptr != NULL)
|
|
|
|
|
strftime(texttime, LEN_TEXT, "%H:%M:%S", &tmp);
|
|
|
|
|
|
|
|
|
|
snprintf (text2, DEBUG_TEXT2LEN-1, "%s.%03d %d %s:%d %s %s\n", texttime, tv.tv_usec/1000, pid,
|
|
|
|
|
snprintf (text2, DEBUG_TEXT2LEN-1, "%s.%03d %d %s:%d %s %s", texttime, tv.tv_usec/1000, pid,
|
|
|
|
|
srcfile, srcline, srcfunc, text1);
|
|
|
|
|
printf ("%s", text2);
|
|
|
|
|
|
|
|
|
|
if (debug_file.length() > 0) {
|
|
|
|
|
/*
|
|
|
|
|
if (type == 0 || (type & _debuglevel) != 0) {
|
|
|
|
|
FILE *f;
|
|
|
|
|
printf ("%s\n", text2);
|
|
|
|
|
f= fopen(debug_file.c_str(), "a");
|
|
|
|
|
f= fopen(DEBUG_FILE, "a");
|
|
|
|
|
if (f) {
|
|
|
|
|
fprintf (f, "%s\n", text2);
|
|
|
|
|
fclose (f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|