Skip to content

Commit f0320c4

Browse files
committed
libsystemd: translate leading log <LEVEL> in stderr logging
Signed-off-by: Joachim Wiberg <[email protected]>
1 parent cbc0d12 commit f0320c4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

libsystemd/sd-daemon.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66

77
#define SD_LISTEN_FDS_START 3
88

9+
/* systemd logging defines for stderr parsing by Finit */
10+
#define SD_EMERG "<0>" /* system is unusable */
11+
#define SD_ALERT "<1>" /* action must be taken immediately */
12+
#define SD_CRIT "<2>" /* critical conditions */
13+
#define SD_ERR "<3>" /* error conditions */
14+
#define SD_WARNING "<4>" /* warning conditions */
15+
#define SD_NOTICE "<5>" /* normal but significant condition */
16+
#define SD_INFO "<6>" /* informational */
17+
#define SD_DEBUG "<7>" /* debug-level messages */
18+
919
/* Basic notification function */
1020
int sd_notify(int unset_environment, const char *state);
1121

src/service.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ static int lredirect(svc_t *svc)
334334
/* Default syslog identity name[:id] */
335335
tag = svc_ident(svc, buf, sizeof(buf));
336336

337+
/* Neither sysklogd logger or native logit tool available */
337338
if (!have_sysklogd && !whichp(_PATH_LOGIT)) {
338339
logit(LOG_INFO, _PATH_LOGIT " missing, using syslog for %s instead", svc->name);
339340
fallback_logger(tag, prio);
@@ -364,7 +365,7 @@ static int lredirect(svc_t *svc)
364365
if (svc->log.prio[0])
365366
prio = svc->log.prio;
366367

367-
if (have_sysklogd) {
368+
if (have_sysklogd && svc->notify != SVC_NOTIFY_SYSTEMD) {
368369
char pid[16];
369370

370371
snprintf(pid, sizeof(pid), "%d", svc_pid);

0 commit comments

Comments
 (0)