LibC: Implement closelog and make syslog print to stddbg
This commit is contained in:
parent
415b20f884
commit
fbcf10c86d
|
@ -580,6 +580,7 @@ extern "C" int printf_impl(const char* format, va_list arguments, int (*putc_fun
|
||||||
case 'm':
|
case 'm':
|
||||||
{
|
{
|
||||||
// NOTE: this is a glibc extension
|
// NOTE: this is a glibc extension
|
||||||
|
// NOTE: syslog() requires %m to be handled
|
||||||
if (options.alternate_form)
|
if (options.alternate_form)
|
||||||
string = strerrorname_np(errno);
|
string = strerrorname_np(errno);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,12 +1,30 @@
|
||||||
#include <BAN/Assert.h>
|
#include <BAN/Assert.h>
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
void openlog(const char*, int, int)
|
static const char* s_ident = nullptr;
|
||||||
|
|
||||||
|
void openlog(const char* ident, int option, int facility)
|
||||||
{
|
{
|
||||||
ASSERT_NOT_REACHED();
|
(void)option;
|
||||||
|
(void)facility;
|
||||||
|
s_ident = ident;
|
||||||
}
|
}
|
||||||
|
|
||||||
void syslog(int, const char*, ...)
|
void syslog(int priority, const char* format, ...)
|
||||||
{
|
{
|
||||||
ASSERT_NOT_REACHED();
|
(void)priority;
|
||||||
|
if (s_ident)
|
||||||
|
fprintf(stddbg, "%s", s_ident);
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
vfprintf(stddbg, format, args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
void closelog()
|
||||||
|
{
|
||||||
|
s_ident = nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue