Added time-stamp and process/thread information to the Windows debug logs.
This commit is contained in:
parent
eda4718f3a
commit
a8a4e9e975
@ -53,27 +53,30 @@
|
||||
// } \
|
||||
//}
|
||||
#define DbgTrace(LEVEL, X, Y) { \
|
||||
char formatBuff[128]; \
|
||||
char printBuff[256]; \
|
||||
FILE *pDebugFile; \
|
||||
if (LEVEL == 0 || KrbMechDebugLevel >= LEVEL) \
|
||||
{ \
|
||||
strcpy(formatBuff, "Krb5Mech "); \
|
||||
strncat(formatBuff, X, sizeof(formatBuff) - 9); \
|
||||
_snprintf(printBuff, sizeof(printBuff), formatBuff, Y); \
|
||||
if (pKrbMechDebugLogFilePath) \
|
||||
{ \
|
||||
pDebugFile = fopen(pKrbMechDebugLogFilePath, "a+"); \
|
||||
if (pDebugFile) \
|
||||
{ \
|
||||
fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \
|
||||
fclose(pDebugFile); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
OutputDebugString(printBuff); \
|
||||
} \
|
||||
}
|
||||
char formatBuff[256]; \
|
||||
char printBuff[384]; \
|
||||
FILE *pDebugFile; \
|
||||
if (LEVEL == 0 || KrbMechDebugLevel >= LEVEL) \
|
||||
{ \
|
||||
SYSTEMTIME sysTime; \
|
||||
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); \
|
||||
if (pKrbMechDebugLogFilePath) \
|
||||
{ \
|
||||
pDebugFile = fopen(pKrbMechDebugLogFilePath, "a+"); \
|
||||
if (pDebugFile) \
|
||||
{ \
|
||||
fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \
|
||||
fflush(pDebugFile); \
|
||||
fclose(pDebugFile); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
OutputDebugString(printBuff); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define INT32_MAX (2147483647)
|
||||
#define UINT32_MAX (4294967295U)
|
||||
|
@ -51,27 +51,30 @@
|
||||
// } \
|
||||
//}
|
||||
#define DbgTrace(LEVEL, X, Y) { \
|
||||
char formatBuff[128]; \
|
||||
char printBuff[256]; \
|
||||
FILE *pDebugFile; \
|
||||
if (LEVEL == 0 || PwdMechDebugLevel >= LEVEL) \
|
||||
{ \
|
||||
strcpy(formatBuff, "CASA_PwdMech "); \
|
||||
strncat(formatBuff, X, sizeof(formatBuff) - 8); \
|
||||
_snprintf(printBuff, sizeof(printBuff), formatBuff, Y); \
|
||||
if (pPwdMechDebugLogFilePath) \
|
||||
{ \
|
||||
pDebugFile = fopen(pPwdMechDebugLogFilePath, "a+"); \
|
||||
if (pDebugFile) \
|
||||
{ \
|
||||
fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \
|
||||
fclose(pDebugFile); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
OutputDebugString(printBuff); \
|
||||
} \
|
||||
}
|
||||
char formatBuff[256]; \
|
||||
char printBuff[384]; \
|
||||
FILE *pDebugFile; \
|
||||
if (LEVEL == 0 || PwdMechDebugLevel >= LEVEL) \
|
||||
{ \
|
||||
SYSTEMTIME sysTime; \
|
||||
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); \
|
||||
if (pPwdMechDebugLogFilePath) \
|
||||
{ \
|
||||
pDebugFile = fopen(pPwdMechDebugLogFilePath, "a+"); \
|
||||
if (pDebugFile) \
|
||||
{ \
|
||||
fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \
|
||||
fflush(pDebugFile); \
|
||||
fclose(pDebugFile); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
OutputDebugString(printBuff); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define INT32_MAX (2147483647)
|
||||
#define UINT32_MAX (4294967295U)
|
||||
|
@ -53,13 +53,15 @@
|
||||
// } \
|
||||
//}
|
||||
#define DbgTrace(LEVEL, X, Y) { \
|
||||
char formatBuff[128]; \
|
||||
char printBuff[256]; \
|
||||
char formatBuff[256]; \
|
||||
char printBuff[384]; \
|
||||
FILE *pDebugFile; \
|
||||
if (LEVEL == 0 || DebugLevel >= LEVEL) \
|
||||
{ \
|
||||
strcpy(formatBuff, "CASA_AuthToken "); \
|
||||
strncat(formatBuff, X, sizeof(formatBuff) - 10); \
|
||||
SYSTEMTIME sysTime; \
|
||||
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); \
|
||||
if (g_pDebugLogFilePath) \
|
||||
{ \
|
||||
@ -67,6 +69,7 @@ FILE *pDebugFile; \
|
||||
if (pDebugFile) \
|
||||
{ \
|
||||
fwrite(printBuff, strlen(printBuff), 1, pDebugFile); \
|
||||
fflush(pDebugFile); \
|
||||
fclose(pDebugFile); \
|
||||
} \
|
||||
} \
|
||||
|
Loading…
Reference in New Issue
Block a user