aboutsummaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-04-28 12:43:17 +0000
committerOmar Polo <op@omarpolo.com>2021-04-28 12:43:17 +0000
commit42447f673f2bacb8b9038b17a7b6ba43a67b5cf7 (patch)
tree7f862f0a56a644356949fe820b8700fe7595d128 /log.c
parent9cc630aa63cfd22553912b5a1fc41a71776cb272 (diff)
send priority to the logger process
Diffstat (limited to 'log.c')
-rw-r--r--log.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/log.c b/log.c
index c86f0e0..aa0d86d 100644
--- a/log.c
+++ b/log.c
@@ -91,10 +91,9 @@ should_log(int priority)
}
static inline void
-send_log(const char *msg, size_t len)
+send_log(int priority, const char *msg, size_t len)
{
- imsg_compose(&logibuf, IMSG_LOG, 0, 0, -1, msg, len);
- /* XXX: use event_once() */
+ imsg_compose(&logibuf, IMSG_LOG, priority, 0, -1, msg, len);
imsg_flush(&logibuf);
}
@@ -131,7 +130,7 @@ vlog(int priority, struct client *c,
if (ec < 0)
fatal("asprintf: %s", strerror(errno));
- send_log(s, ec+1);
+ send_log(priority, s, ec+1);
free(fmted);
free(s);
@@ -244,7 +243,7 @@ log_request(struct client *c, char *meta, size_t l)
(int)(t-meta), meta);
if (ec < 0)
err(1, "asprintf");
- send_log(fmted, ec+1);
+ send_log(LOG_NOTICE, fmted, ec+1);
free(fmted);
}
@@ -268,7 +267,7 @@ handle_imsg_log(struct imsgbuf *ibuf, struct imsg *imsg, size_t datalen)
print_date();
fprintf(stderr, "%s\n", msg);
} else
- syslog(LOG_DAEMON, "%s", msg);
+ syslog(LOG_DAEMON | imsg->hdr.peerid, "%s", msg);
}
static void