Show milliseconds in SILC_LOG_DEBUG and family outputs
[runtime.git] / lib / silcutil / silclog.c
index 481dfccb2da60307361bade1483ed190f454dd9a..e857bac29789cf85c96cd5fe7e794b18c5913faa 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2007 Pekka Riikonen
+  Copyright (C) 1997 - 2008 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -16,9 +16,8 @@
   GNU General Public License for more details.
 
 */
-/* $Id$ */
 
-#include "silc.h"
+#include "silcruntime.h"
 
 /* SilcLogSettings context */
 typedef struct {
@@ -243,6 +242,9 @@ SilcBool silc_log_set_file(SilcLogType type, char *filename,
   FILE *fp = NULL;
   SilcLog log;
 
+  if (!scheduler)
+    scheduler = silc_schedule_get_global();
+
   log = silc_log_get_context(type);
   if (!log)
     return FALSE;
@@ -424,7 +426,7 @@ void silc_log_set_debug_string(const char *debug_string)
   int len;
   if ((strchr(debug_string, '(') && strchr(debug_string, ')')) ||
       strchr(debug_string, '$'))
-    string = strdup(debug_string);
+    string = silc_strdup(debug_string);
   else
     string = silc_string_regexify(debug_string);
   len = strlen(string);
@@ -513,8 +515,8 @@ void silc_log_output_debug(char *file, const char *function,
 #ifdef SILC_SYMBIAN
   silc_symbian_debug(function, line, string);
 #else
-  fprintf(stderr, "%02d:%02d:%02d %s:%d: %s\n", curtime.hour,
-         curtime.minute, curtime.second, function, line,
+  fprintf(stderr, "%02d:%02d:%02d.%03d %s:%d: %s\n", curtime.hour,
+         curtime.minute, curtime.second, curtime.msecond, function, line,
          string);
   fflush(stderr);
 #endif /* SILC_SYMBIAN */