Added BSD extension vsyslog() - is also found on Linux.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23835 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-02-03 15:31:16 +00:00
parent 6b1fc6fcb7
commit e5bc2a9e7a
2 changed files with 56 additions and 41 deletions

View File

@ -6,6 +6,9 @@
#define _SYSLOG_H_
#include <stdarg.h>
/* options for openlog() */
#define LOG_PID (1 << 12) /* log the process (thread/team) ID with each message */
@ -80,6 +83,9 @@ extern void openlog_thread(const char *ident, int logopt, int facility);
extern void log_thread(int priority, const char *message, ...);
extern int setlogmask_thread(int priorityMask);
/* BSD extensions */
extern void vsyslog(int priority, const char *message, va_list args);
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@ -162,7 +162,42 @@ send_syslog_message(syslog_context *context, int priority, const char *text,
}
// #pragma mark - public Be API
// #pragma mark - POSIX API
void
closelog(void)
{
closelog_thread();
}
void
openlog(const char *ident, int options, int facility)
{
openlog_thread(ident, options, facility);
}
int
setlogmask(int priorityMask)
{
return setlogmask_thread(priorityMask);
}
void
syslog(int priority, const char *message, ...)
{
va_list args;
va_start(args, message);
send_syslog_message(get_context(), priority, message, args);
va_end(args);
}
// #pragma mark - Be extensions
// ToDo: it would probably be better to export these symbols as weak symbols only
@ -255,38 +290,12 @@ log_thread(int priority, const char *message, ...)
}
// #pragma mark - POSIX API
// #pragma mark - BSD extensions
void
closelog(void)
vsyslog(int priority, const char *message, va_list args)
{
closelog_thread();
}
void
openlog(const char *ident, int options, int facility)
{
openlog_thread(ident, options, facility);
}
int
setlogmask(int priorityMask)
{
return setlogmask_thread(priorityMask);
}
void
syslog(int priority, const char *message, ...)
{
va_list args;
va_start(args, message);
send_syslog_message(get_context(), priority, message, args);
va_end(args);
}