Skip to content

Commit 2de5a3b

Browse files
committed
Simplify logging to STDOUT and avoid writing logs to STDOUT twice
1 parent dea445c commit 2de5a3b

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/metalog.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,15 +1306,6 @@ static int log_line(LogLineType loglinetype, char *buf)
13061306
return processLogLine(logcode, prg, info);
13071307
}
13081308

1309-
static int log_udp(char *buf, int bsize)
1310-
{
1311-
buf[bsize] = '\0';
1312-
if (write(1, buf, strlen(buf)) != (ssize_t) strlen(buf))
1313-
return -1;
1314-
1315-
return log_line(LOGLINETYPE_SYSLOG, buf);
1316-
}
1317-
13181309
static int log_kernel(char *buf, int bsize)
13191310
{
13201311
char *s = buf;
@@ -1404,7 +1395,9 @@ static int process(const int sockets[])
14041395
;
14051396
if (rd == -1)
14061397
return -1;
1407-
log_udp(buffer[0], rd);
1398+
1399+
buffer[0][rd] = '\0';
1400+
log_line(LOGLINETYPE_SYSLOG, buffer[0]);
14081401
}
14091402

14101403
/* STREAM_SOCKET (klog) */

0 commit comments

Comments
 (0)