X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Flog.c;h=6d8fdd24d1ac518601a6e13757ea7a8edf312e85;hb=49e56fb37f587bf0e69d2fbe76fa0793f898c26f;hp=9cde369c0a5364ed46f73db319c7b589f1e9e06a;hpb=fdfe718d5ed9f551120a29af214883d59ddb85d1;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/log.c b/src/src/log.c index 9cde369c0..6d8fdd24d 100644 --- a/src/src/log.c +++ b/src/src/log.c @@ -145,8 +145,6 @@ write_syslog(int priority, const uschar *s) int len, pass; int linecount = 0; -if (running_in_test_harness) return; - if (!syslog_pid && LOGGING(pid)) s = string_sprintf("%.*s%s", (int)pid_position[0], s, s + pid_position[1]); if (!syslog_timestamp) @@ -159,7 +157,7 @@ if (!syslog_timestamp) len = Ustrlen(s); #ifndef NO_OPENLOG -if (!syslog_open) +if (!syslog_open && !running_in_test_harness) { # ifdef SYSLOG_LOG_PID openlog(CS syslog_processname, LOG_PID|LOG_CONS, syslog_facility); @@ -189,15 +187,23 @@ for (pass = 0; pass < 2; pass++) tlen -= plen; if (ss[plen] == '\n') tlen--; /* chars left */ - if (pass == 0) linecount++; else - { + if (pass == 0) + linecount++; + else if (running_in_test_harness) + if (linecount == 1) + fprintf(stderr, "SYSLOG: '%.*s'\n", plen, ss); + else + fprintf(stderr, "SYSLOG: '[%d%c%d] %.*s'\n", i, + ss[plen] == '\n' && tlen != 0 ? '\\' : '/', + linecount, plen, ss); + else if (linecount == 1) syslog(priority, "%.*s", plen, ss); else syslog(priority, "[%d%c%d] %.*s", i, ss[plen] == '\n' && tlen != 0 ? '\\' : '/', linecount, plen, ss); - } + ss += plen; if (*ss == '\n') ss++; }