]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Minor refactoring to allow redirection of debug messages from unit tests.
authorLinux Karlsson <karlsson@ntp.org>
Fri, 13 Aug 2010 14:54:32 +0000 (16:54 +0200)
committerLinux Karlsson <karlsson@ntp.org>
Fri, 13 Aug 2010 14:54:32 +0000 (16:54 +0200)
bk: 4c655ca8O2qeBuifN4caKuTdtnF41A

sntp/log.c

index 69d788135c57fa1238a33b09f9a7adecf0a6d350..15ce93e2342a15cf007b5265cd0838d7b9cf6069 100644 (file)
@@ -6,6 +6,7 @@ int init = 0;
 int filelog = 0;
 
 FILE *log_file;
+FILE **debug_log_file = &stderr;
 
 
 void log_msg(char *message, char type) {
@@ -40,7 +41,7 @@ void debug_msg(char *message) {
                time_t cur_time = time(NULL);
                char *timestamp = ctime(&cur_time);
 
-               fprintf(stderr, "%s: %s\n", timestamp, message);
+               fprintf(*debug_log_file, "%s: %s\n", timestamp, message);
        }
        else {
                syslog(LOG_DEBUG