From 0b5bc4ecd90447eeae919c30669d8dbd0b3be4b6 Mon Sep 17 00:00:00 2001 From: Giovanni Giacobbi Date: Sat, 30 Nov 2002 13:25:08 +0000 Subject: [PATCH] Extended the SILC_SERVER_LOG_ERROR macro to all available logging channels. Affected files silcd/silcd.c, silcd/server.h. --- apps/silcd/server.h | 15 +++++++++++---- apps/silcd/silcd.c | 9 +++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/apps/silcd/server.h b/apps/silcd/server.h index d7b2d3da..1204b244 100644 --- a/apps/silcd/server.h +++ b/apps/silcd/server.h @@ -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 diff --git a/apps/silcd/silcd.c b/apps/silcd/silcd.c index b0155df1..f2898022 100644 --- a/apps/silcd/silcd.c +++ b/apps/silcd/silcd.c @@ -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); -- 2.43.0