diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-12 13:26:26 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-12 13:26:26 +0000 |
commit | 4bea2efb74be2eab9b66421b54bfb7a786566819 (patch) | |
tree | aad4fa69906c5037671aa90326bd60b5c268f809 | |
parent | bb59112c859b0da74e11968716f2cc51dc93f330 (diff) |
netlib:
- added a thread id to a log;
- get rid of that (NULL)
git-svn-id: http://svn.miranda-ng.org/main/trunk@9771 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | src/modules/netlib/netliblog.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 92409ddeb6..8b09f49d1d 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -302,35 +302,28 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) }
/* if the Netlib user handle is NULL, just pretend its not */
- NetlibUser nludummy;
- if (nlu == NULL) {
- if (!logOptions.toLog)
- return 1;
- nlu = &nludummy;
- nlu->user.szSettingsModule = "(NULL)";
- }
- else if (!nlu->toLog)
+ if (nlu != NULL && !nlu->toLog)
return 1;
LARGE_INTEGER liTimeNow;
char szTime[32], szHead[128];
switch (logOptions.timeFormat) {
case TIMEFORMAT_HHMMSS:
- GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER,
- NULL, NULL, szTime, SIZEOF(szTime));
+ GetTimeFormatA(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, NULL, NULL, szTime, SIZEOF(szTime));
+ strcat(szTime, " ");
break;
case TIMEFORMAT_MILLISECONDS:
QueryPerformanceCounter(&liTimeNow);
liTimeNow.QuadPart -= mirandaStartTime;
- mir_snprintf(szTime, SIZEOF(szTime), "%I64u.%03I64u", liTimeNow.QuadPart / perfCounterFreq,
+ mir_snprintf(szTime, SIZEOF(szTime), "%I64u.%03I64u ", liTimeNow.QuadPart / perfCounterFreq,
1000 * (liTimeNow.QuadPart % perfCounterFreq) / perfCounterFreq);
break;
case TIMEFORMAT_MICROSECONDS:
QueryPerformanceCounter(&liTimeNow);
liTimeNow.QuadPart -= mirandaStartTime;
- mir_snprintf(szTime, SIZEOF(szTime), "%I64u.%06I64u", liTimeNow.QuadPart / perfCounterFreq,
+ mir_snprintf(szTime, SIZEOF(szTime), "%I64u.%06I64u ", liTimeNow.QuadPart / perfCounterFreq,
1000000 * (liTimeNow.QuadPart % perfCounterFreq) / perfCounterFreq);
break;
@@ -338,12 +331,12 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam) szTime[0] = '\0';
break;
}
- if (logOptions.timeFormat || logOptions.showUser)
- mir_snprintf(szHead, SIZEOF(szHead) - 1, "[%s%s%s] ", szTime,
- (logOptions.showUser && logOptions.timeFormat) ? " " : "",
- logOptions.showUser ? nlu->user.szSettingsModule : "");
+
+ char *szUser = (logOptions.showUser) ? (nlu == NULL ? NULL : nlu->user.szSettingsModule) : NULL;
+ if (szUser)
+ mir_snprintf(szHead, SIZEOF(szHead) - 1, "[%s%04X] [%s] ", szTime, GetCurrentThreadId(), szUser);
else
- szHead[0] = 0;
+ mir_snprintf(szHead, SIZEOF(szHead) - 1, "[%s%04X] ", szTime, GetCurrentThreadId());
if (logOptions.toOutputDebugString) {
if (szHead[0])
|