(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);
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
}
}
-/* 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;
}
*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);