Logfile add date (#260)

* add date in the log file in MM/DD/YYYY format

* changed date format in log file to bigendian ISO 8601 (YYYY-MM-DD) (#256)

The "madendian" MM/DD/YYYY format is not used outside the United States
(and rather irritating elsewhere)
This commit is contained in:
Manoj Ampalam 2018-01-16 19:56:06 -08:00 committed by GitHub
parent b62ae95cd2
commit 5e0833f69d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -98,8 +98,8 @@ syslog(int priority, const char *format, const char *formatBuffer)
return;
GetLocalTime(&st);
r = _snprintf_s(msgbufTimestamp, sizeof(msgbufTimestamp), _TRUNCATE, "%d %02d/%02d/%04d %02d:%02d:%02d:%03d %s\n",
GetCurrentProcessId(), st.wMonth, st.wDay, st.wYear, st.wHour, st.wMinute, st.wSecond,
r = _snprintf_s(msgbufTimestamp, sizeof(msgbufTimestamp), _TRUNCATE, "%d %04d-%02d-%02d %02d:%02d:%02d.%03d %s\n",
GetCurrentProcessId(), st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond,
st.wMilliseconds, formatBuffer);
if (r == -1) {
_write(logfd, "_snprintf_s failed.", 30);
@ -107,4 +107,4 @@ syslog(int priority, const char *format, const char *formatBuffer)
}
msgbufTimestamp[strnlen(msgbufTimestamp, MSGBUFSIZ)] = '\0';
_write(logfd, msgbufTimestamp, (unsigned int)strnlen(msgbufTimestamp, MSGBUFSIZ));
}
}