Added time-stamp and process/thread information to the Windows debug logs.

This commit is contained in:
Juan Carlos Luciani 2008-01-02 17:45:07 +00:00
parent eda4718f3a
commit a8a4e9e975
3 changed files with 55 additions and 46 deletions

View File

@ -53,13 +53,15 @@
// } \ // } \
//} //}
#define DbgTrace(LEVEL, X, Y) { \ #define DbgTrace(LEVEL, X, Y) { \
char formatBuff[128]; \ char formatBuff[256]; \
char printBuff[256]; \ char printBuff[384]; \
FILE *pDebugFile; \ FILE *pDebugFile; \
if (LEVEL == 0 || KrbMechDebugLevel >= LEVEL) \ if (LEVEL == 0 || KrbMechDebugLevel >= LEVEL) \
{ \ { \
strcpy(formatBuff, "Krb5Mech "); \ SYSTEMTIME sysTime; \
strncat(formatBuff, X, sizeof(formatBuff) - 9); \ GetLocalTime(&sysTime); \
_snprintf(formatBuff, sizeof(formatBuff), "[%X-%X] [%02d:%02d:%02d] CASA_KrbMech ", GetCurrentProcessId(), GetCurrentThreadId(), sysTime.wHour, sysTime.wMinute, sysTime.wSecond); \
strncat(formatBuff, X, sizeof(formatBuff) - strlen(formatBuff) - 1); \
_snprintf(printBuff, sizeof(printBuff), formatBuff, Y); \ _snprintf(printBuff, sizeof(printBuff), formatBuff, Y); \
if (pKrbMechDebugLogFilePath) \ if (pKrbMechDebugLogFilePath) \
{ \ { \
@ -67,6 +69,7 @@ FILE *pDebugFile; \
if (pDebugFile) \ if (pDebugFile) \
{ \ { \
fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \ fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \
fflush(pDebugFile); \
fclose(pDebugFile); \ fclose(pDebugFile); \
} \ } \
} \ } \

View File

@ -51,13 +51,15 @@
// } \ // } \
//} //}
#define DbgTrace(LEVEL, X, Y) { \ #define DbgTrace(LEVEL, X, Y) { \
char formatBuff[128]; \ char formatBuff[256]; \
char printBuff[256]; \ char printBuff[384]; \
FILE *pDebugFile; \ FILE *pDebugFile; \
if (LEVEL == 0 || PwdMechDebugLevel >= LEVEL) \ if (LEVEL == 0 || PwdMechDebugLevel >= LEVEL) \
{ \ { \
strcpy(formatBuff, "CASA_PwdMech "); \ SYSTEMTIME sysTime; \
strncat(formatBuff, X, sizeof(formatBuff) - 8); \ GetLocalTime(&sysTime); \
_snprintf(formatBuff, sizeof(formatBuff), "[%X-%X] [%02d:%02d:%02d] CASA_PwdMech ", GetCurrentProcessId(), GetCurrentThreadId(), sysTime.wHour, sysTime.wMinute, sysTime.wSecond); \
strncat(formatBuff, X, sizeof(formatBuff) - strlen(formatBuff) - 1); \
_snprintf(printBuff, sizeof(printBuff), formatBuff, Y); \ _snprintf(printBuff, sizeof(printBuff), formatBuff, Y); \
if (pPwdMechDebugLogFilePath) \ if (pPwdMechDebugLogFilePath) \
{ \ { \
@ -65,6 +67,7 @@ FILE *pDebugFile; \
if (pDebugFile) \ if (pDebugFile) \
{ \ { \
fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \ fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \
fflush(pDebugFile); \
fclose(pDebugFile); \ fclose(pDebugFile); \
} \ } \
} \ } \

View File

@ -53,13 +53,15 @@
// } \ // } \
//} //}
#define DbgTrace(LEVEL, X, Y) { \ #define DbgTrace(LEVEL, X, Y) { \
char formatBuff[128]; \ char formatBuff[256]; \
char printBuff[256]; \ char printBuff[384]; \
FILE *pDebugFile; \ FILE *pDebugFile; \
if (LEVEL == 0 || DebugLevel >= LEVEL) \ if (LEVEL == 0 || DebugLevel >= LEVEL) \
{ \ { \
strcpy(formatBuff, "CASA_AuthToken "); \ SYSTEMTIME sysTime; \
strncat(formatBuff, X, sizeof(formatBuff) - 10); \ GetLocalTime(&sysTime); \
_snprintf(formatBuff, sizeof(formatBuff), "[%X-%X] [%02d:%02d:%02d] CASA_AuthToken ", GetCurrentProcessId(), GetCurrentThreadId(), sysTime.wHour, sysTime.wMinute, sysTime.wSecond); \
strncat(formatBuff, X, sizeof(formatBuff) - strlen(formatBuff) - 1); \
_snprintf(printBuff, sizeof(printBuff), formatBuff, Y); \ _snprintf(printBuff, sizeof(printBuff), formatBuff, Y); \
if (g_pDebugLogFilePath) \ if (g_pDebugLogFilePath) \
{ \ { \
@ -67,6 +69,7 @@ FILE *pDebugFile; \
if (pDebugFile) \ if (pDebugFile) \
{ \ { \
fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \ fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \
fflush(pDebugFile); \
fclose(pDebugFile); \ fclose(pDebugFile); \
} \ } \
} \ } \