- implement log-time-ascii on windows.

git-svn-id: file:///svn/unbound/trunk@2684 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2012-06-15 08:24:44 +00:00
parent c42a74b77c
commit eb03758c79
2 changed files with 10 additions and 0 deletions

View file

@ -1,5 +1,6 @@
11 June 2012: Wouter
- bug #452: fix crash on assert in mesh_state_attachment.
- implement log-time-ascii on windows.
30 May 2012: Wouter
- silence warning from swig-generated code (md set but not used in

View file

@ -171,6 +171,8 @@ log_vmsg(int pri, const char* type,
#if defined(HAVE_STRFTIME) && defined(HAVE_LOCALTIME_R)
char tmbuf[32];
struct tm tm;
#elif defined(UB_ON_WINDOWS)
char tmbuf[128], dtbuf[128];
#endif
(void)pri;
vsnprintf(message, sizeof(message), format, args);
@ -218,6 +220,13 @@ log_vmsg(int pri, const char* type,
fprintf(logfile, "%s %s[%d:%x] %s: %s\n", tmbuf,
ident, (int)getpid(), tid?*tid:0, type, message);
} else
#elif defined(UB_ON_WINDOWS)
if(log_time_asc && GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, NULL,
tmbuf, sizeof(tmbuf)) && GetDateFormat(LOCALE_USER_DEFAULT, 0,
NULL, NULL, dtbuf, sizeof(dtbuf))) {
fprintf(logfile, "%s %s %s[%d:%x] %s: %s\n", dtbuf, tmbuf,
ident, (int)getpid(), tid?*tid:0, type, message);
} else
#endif
fprintf(logfile, "[%u] %s[%d:%x] %s: %s\n", (unsigned)now,
ident, (int)getpid(), tid?*tid:0, type, message);