8 static char const *priov
[] = {
9 [LOG_EMERG
] = "EMERG:",
10 [LOG_ALERT
] = "ALERT:",
13 [LOG_WARNING
] = "WARNING:",
14 [LOG_NOTICE
] = "NOTICE:",
16 [LOG_DEBUG
] = "DEBUG:",
19 static ssize_t
cookie_writer(void *cookie
, char const *data
, size_t leng
)
21 int prio
= LOG_DEBUG
, len
;
24 len
= strlen(priov
[prio
]);
25 } while (memcmp(data
, priov
[prio
], len
) && --prio
>= 0);
34 while (*data
== ' ') {
39 syslog(prio
, "%.*s", (int) leng
, data
);
44 static cookie_io_functions_t cookie_log
= {
45 .write
= cookie_writer
,
48 void to_std_log(FILE **fp
)
50 setvbuf(*fp
= fopencookie(NULL
, "w", cookie_log
), NULL
, _IOLBF
, 0);