]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- implement log-time-ascii on windows.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 15 Jun 2012 08:24:44 +0000 (08:24 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 15 Jun 2012 08:24:44 +0000 (08:24 +0000)
git-svn-id: file:///svn/unbound/trunk@2684 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
util/log.c

index 3f3bfa97a7c54bd7bb1f4faf72babfcc30554a12..ca4478665ff4c53bdb1043eb568674991f7566ed 100644 (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
index fc07dc6a9cba253c86e9d698ce10a291b504ca45..8c09c7ce3122652bae293d3eabade15df377e593 100644 (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);