libsyslog: honor LIB_PTRIM when logging to stderr
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
parent
221ae0abe0
commit
4fdbb64c51
14
src/syslog.c
14
src/syslog.c
@ -477,11 +477,21 @@ output:
|
||||
DEC();
|
||||
cnt = p - tbuf;
|
||||
|
||||
/* Output to stderr if requested. */
|
||||
/* Output to stderr if requested, PTRIM logs only message. */
|
||||
if (data->log_stat & LOG_PERROR) {
|
||||
struct iovec *piov;
|
||||
int piovcnt;
|
||||
|
||||
iov[iovcnt].iov_base = __UNCONST(CRLF + 1);
|
||||
iov[iovcnt].iov_len = 1;
|
||||
(void)writev(STDERR_FILENO, iov, iovcnt + 1);
|
||||
if (data->log_stat & LOG_PTRIM) {
|
||||
piov = &iov[iovcnt - 1];
|
||||
piovcnt = 2;
|
||||
} else {
|
||||
piov = iov;
|
||||
piovcnt = iovcnt + 1;
|
||||
}
|
||||
(void)writev(STDERR_FILENO, piov, piovcnt + 1);
|
||||
}
|
||||
|
||||
/* Don't write to system log, instead use fd in log_file */
|
||||
|
@ -187,7 +187,7 @@ CODE facilitynames[] = {
|
||||
#define LOG_NDELAY 0x008 /* don't delay open */
|
||||
#define LOG_NOWAIT 0x010 /* don't wait for console forks: DEPRECATED */
|
||||
#define LOG_PERROR 0x020 /* log to stderr as well */
|
||||
#define LOG_PTRIM 0x040 /* trim tag and pid from messages to stderr */
|
||||
#define LOG_PTRIM 0x040 /* trim anything syslog addded when writing to stderr */
|
||||
#define LOG_NLOG 0x080 /* don't write to the system log */
|
||||
#define LOG_STDOUT 0x100 /* like nlog, for debugging syslogp() API */
|
||||
#define LOG_RFC3164 0x200 /* Log to remote/ipc socket in old BSD format */
|
||||
|
Loading…
Reference in New Issue
Block a user