1
0
Fork 0

Feature: Added support for %R (sock_t) for debug logging

This commit is contained in:
Philipp Schafft 2022-03-07 10:57:32 +00:00
parent a6db913245
commit bb12858abe
1 changed files with 12 additions and 0 deletions

View File

@ -51,6 +51,7 @@
#include <windows.h>
#endif
#include "../net/sock.h"
#include "log.h"
#define LOG_MAXLOGS 25
@ -610,6 +611,17 @@ static void __vsnprintf(char *str, size_t size, const char *format, va_list ap)
arg = buf;
}
/* fall through */
case 'R':
if (!arg) {
sock_t sock = va_arg(ap, sock_t);
if (sock == SOCK_ERROR) {
snprintf(buf, sizeof(buf), "SOCK_ERROR");
} else {
snprintf(buf, sizeof(buf), "%lli", (long long int)sock);
}
arg = buf;
}
/* fall through */
case 's':
case 'H':
// TODO.