From 87a98412a1e46a8674239fe5ef1a27ba8d068992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 12 Nov 2003 16:34:12 +0000 Subject: [PATCH] Now correctly differentiates between options and priority/facilities. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5334 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/syslog.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/kernel/libroot/posix/syslog.cpp b/src/kernel/libroot/posix/syslog.cpp index e6811d4f2c..eb5f7a2e70 100644 --- a/src/kernel/libroot/posix/syslog.cpp +++ b/src/kernel/libroot/posix/syslog.cpp @@ -16,14 +16,16 @@ struct syslog_context { char ident[B_OS_NAME_LENGTH]; - int32 mask; + int16 mask; + int16 facility; int32 options; }; static syslog_context sTeamContext = { "", -1, - 0 + LOG_USER, + LOG_CONS }; static int32 sThreadContextSlot = -1; @@ -96,13 +98,14 @@ get_context() */ static void -send_syslog_message(syslog_context *context, int options, const char *text, va_list args) +send_syslog_message(syslog_context *context, int priority, const char *text, va_list args) { + int options = context->options; + // do we have to do anything? - if ((context->mask & LOG_MASK(SYSLOG_PRIORITY(options))) == 0) + if ((context->mask & LOG_MASK(SYSLOG_PRIORITY(priority))) == 0) return; - options |= context->options; port_id port = find_port(SYSLOG_PORT_NAME); if ((options & LOG_PERROR) != 0 @@ -127,6 +130,7 @@ send_syslog_message(syslog_context *context, int options, const char *text, va_l message.from = find_thread(NULL); message.when = real_time_clock(); message.options = options; + message.priority = priority | context->facility; strcpy(message.ident, context->ident); int length = vsnprintf(message.message, sizeof(buffer) - sizeof(syslog_message), text, args); @@ -154,7 +158,8 @@ openlog_team(const char *ident, int options, int facility) if (ident != NULL) strcpy(sTeamContext.ident, ident); - sTeamContext.options = facility | options; + sTeamContext.options = options; + sTeamContext.facility = SYSLOG_FACILITY(facility); } @@ -200,7 +205,8 @@ openlog_thread(const char *ident, int options, int facility) if (ident) strcpy(context->ident, ident); - context->options = options | facility; + context->options = options; + context->facility = SYSLOG_FACILITY(facility); }