From: Wouter Wijngaards Date: Fri, 15 Jun 2012 08:24:44 +0000 (+0000) Subject: - implement log-time-ascii on windows. X-Git-Tag: release-1.4.18rc1~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb03758c793dc6ae0f10debda5126f43e67a643b;p=thirdparty%2Funbound.git - implement log-time-ascii on windows. git-svn-id: file:///svn/unbound/trunk@2684 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index 3f3bfa97a..ca4478665 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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 diff --git a/util/log.c b/util/log.c index fc07dc6a9..8c09c7ce3 100644 --- a/util/log.c +++ b/util/log.c @@ -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);