9 static char const *priov
[] = {
10 [LOG_EMERG
] = "EMERG:",
11 [LOG_ALERT
] = "ALERT:",
14 [LOG_WARNING
] = "WARNING:",
15 [LOG_NOTICE
] = "NOTICE:",
17 [LOG_DEBUG
] = "DEBUG:",
20 static ssize_t
cookie_writer(void *cookie
, char const *data
, size_t leng
)
22 int prio
= LOG_DEBUG
, len
;
25 len
= strlen(priov
[prio
]);
26 } while (memcmp(data
, priov
[prio
], len
) && --prio
>= 0);
35 while (*data
== ' ') {
40 syslog(prio
, "%.*s", (int) leng
, data
);
45 static cookie_io_functions_t cookie_log
= {
46 .write
= cookie_writer
,
49 void to_std_log(FILE **fp
)
51 setvbuf(*fp
= fopencookie(NULL
, "w", cookie_log
), NULL
, _IOLBF
, 0);