updates. New data types.
[silc.git] / lib / silcutil / silclog.c
index 24f3ddcee748dabba4de0fbc190fdcd09de08bd5..13d186476cafa489e0d281358b22c0d8259dc2d5 100644 (file)
@@ -22,7 +22,7 @@
 #include "silcincludes.h"
 
 /* Set TRUE/FALSE to enable/disable debugging */
-int silc_debug;
+int silc_debug = FALSE;
 
 /* SILC Log name strings. These strings are printed to the log file. */
 const SilcLogTypeName silc_log_types[] =
@@ -39,10 +39,10 @@ char *log_info_file;
 char *log_warning_file;
 char *log_error_file;
 char *log_fatal_file;
-unsigned int log_info_size;
-unsigned int log_warning_size;
-unsigned int log_error_size;
-unsigned int log_fatal_size;
+uint32 log_info_size;
+uint32 log_warning_size;
+uint32 log_error_size;
+uint32 log_fatal_size;
 
 /* Log callbacks. If these are set by the application these are used
    instead of the default functions in this file. */
@@ -55,25 +55,9 @@ static SilcLogCb fatal_cb = NULL;
 static SilcDebugCb debug_cb = NULL;
 static SilcDebugHexdumpCb debug_hexdump_cb = NULL;
 
-/* Formats arguments to a string and returns it after allocating memory
-   for it. It must be remembered to free it later. */
-
-char *silc_log_format(char *fmt, ...)
-{
-  va_list args;
-  static char buf[8192];
-
-  memset(buf, 0, sizeof(buf));
-  va_start(args, fmt);
-  vsnprintf(buf, sizeof(buf) - 1, fmt, args);
-  va_end(args);
-
-  return strdup(buf);
-}
-
 /* Outputs the log message to what ever log file selected. */
 
-void silc_log_output(const char *filename, unsigned int maxsize,
+void silc_log_output(const char *filename, uint32 maxsize,
                      SilcLogType type, char *string)
 {
   FILE *fp;
@@ -163,7 +147,6 @@ void silc_log_output_debug(char *file, char *function,
       return;
     }
 
-  /* fprintf(stderr, "%s:%s:%d: %s\n", file, function, line, string); */
   fprintf(stderr, "%s:%d: %s\n", function, line, string);
   fflush(stderr);
   silc_free(string);
@@ -173,7 +156,7 @@ void silc_log_output_debug(char *file, char *function,
 
 void silc_log_output_hexdump(char *file, char *function, 
                             int line, void *data_in,
-                            unsigned int len, char *string)
+                            uint32 len, char *string)
 {
   int i, k;
   int off, pos, count;
@@ -191,7 +174,6 @@ void silc_log_output_hexdump(char *file, char *function,
       return;
     }
 
-  /* fprintf(stderr, "%s:%s:%d: %s\n", file, function, line, string); */
   fprintf(stderr, "%s:%d: %s\n", function, line, string);
   silc_free(string);
 
@@ -254,10 +236,10 @@ void silc_log_output_hexdump(char *file, char *function,
 
 /* Sets log files */
 
-void silc_log_set_files(char *info, unsigned int info_size, 
-                       char *warning, unsigned int warning_size,
-                       char *error, unsigned int error_size,
-                       char *fatal, unsigned int fatal_size)
+void silc_log_set_files(char *info, uint32 info_size, 
+                       char *warning, uint32 warning_size,
+                       char *error, uint32 error_size,
+                       char *fatal, uint32 fatal_size)
 {
   log_info_file = info;
   log_warning_file = warning;