Extended the SILC_SERVER_LOG_ERROR macro to all available logging
authorGiovanni Giacobbi <johnny@silcnet.org>
Sat, 30 Nov 2002 13:25:08 +0000 (13:25 +0000)
committerGiovanni Giacobbi <johnny@silcnet.org>
Sat, 30 Nov 2002 13:25:08 +0000 (13:25 +0000)
channels.  Affected files silcd/silcd.c, silcd/server.h.

apps/silcd/server.h
apps/silcd/silcd.c

index d7b2d3da912461110cd92f94a1c591eb5445185e..1204b2449f59feb6bf3406b17db736bb5130ff97 100644 (file)
@@ -120,9 +120,16 @@ do {                                                                       \
   (sock->protocol && sock->protocol->protocol &&                       \
    sock->protocol->protocol->type == SILC_PROTOCOL_SERVER_BACKUP)
 
-/* Output an error message wether to stderr or LOG_ERROR if we are in the
-   background. */
-#define SILC_SERVER_LOG_ERROR(fmt) silc_server_stderr(silc_format fmt)
+/* Output a message to stderr or to the appropriate log facility wether
+   we are in the background or not. */
+#define SILC_SERVER_LOG_INFO(fmt)                                      \
+  silc_server_stderr(SILC_LOG_INFO, silc_format fmt)
+#define SILC_SERVER_LOG_WARNING(fmt)                                   \
+  silc_server_stderr(SILC_LOG_WARNING, silc_format fmt)
+#define SILC_SERVER_LOG_ERROR(fmt)                                     \
+  silc_server_stderr(SILC_LOG_ERROR, silc_format fmt)
+#define SILC_SERVER_LOG_FATAL(fmt)                                     \
+  silc_server_stderr(SILC_LOG_WARNING, silc_format fmt)
 
 /* Prototypes */
 int silc_server_alloc(SilcServer *new_server);
@@ -242,6 +249,6 @@ SilcBuffer silc_server_get_client_channel_list(SilcServer server,
                                               bool get_private,
                                               bool get_secret,
                                               SilcBuffer *user_mode_list);
-void silc_server_stderr(char *message);
+void silc_server_stderr(SilcLogType type, char *message);
 
 #endif
index b0155df1edd9990043a43a63324a18cb3297812b..f28980229e675c3d086917a21fe28ea56c2400ac 100644 (file)
@@ -389,10 +389,10 @@ static void silc_get_debug_level(int level)
     }
 }
 
-/* This function should not be called directly but thru the wrapper
-   macro SILC_SERVER_LOG_STDERR() */
+/* This function should not be called directly but through the appropriate
+   wrapper macro defined in server.h */
 
-void silc_server_stderr(char *message)
+void silc_server_stderr(SilcLogType type, char *message)
 {
   if (silcd->background) {
     char *p, *n = message;
@@ -407,7 +407,8 @@ void silc_server_stderr(char *message)
     }
     *n = 0;
 
-    silc_log_output(SILC_LOG_ERROR, message);
+    /* the message is freed inside the logging function */
+    silc_log_output(type, message);
   }
   else {
     fprintf(stderr, "%s\n", message);