mirror of
https://github.com/omar-polo/gmid.git
synced 2024-09-27 21:11:51 +02:00
send priority to the logger process
This commit is contained in:
parent
9cc630aa63
commit
42447f673f
11
log.c
11
log.c
@ -91,10 +91,9 @@ should_log(int priority)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
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);
|
imsg_compose(&logibuf, IMSG_LOG, priority, 0, -1, msg, len);
|
||||||
/* XXX: use event_once() */
|
|
||||||
imsg_flush(&logibuf);
|
imsg_flush(&logibuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +130,7 @@ vlog(int priority, struct client *c,
|
|||||||
if (ec < 0)
|
if (ec < 0)
|
||||||
fatal("asprintf: %s", strerror(errno));
|
fatal("asprintf: %s", strerror(errno));
|
||||||
|
|
||||||
send_log(s, ec+1);
|
send_log(priority, s, ec+1);
|
||||||
|
|
||||||
free(fmted);
|
free(fmted);
|
||||||
free(s);
|
free(s);
|
||||||
@ -244,7 +243,7 @@ log_request(struct client *c, char *meta, size_t l)
|
|||||||
(int)(t-meta), meta);
|
(int)(t-meta), meta);
|
||||||
if (ec < 0)
|
if (ec < 0)
|
||||||
err(1, "asprintf");
|
err(1, "asprintf");
|
||||||
send_log(fmted, ec+1);
|
send_log(LOG_NOTICE, fmted, ec+1);
|
||||||
free(fmted);
|
free(fmted);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +267,7 @@ handle_imsg_log(struct imsgbuf *ibuf, struct imsg *imsg, size_t datalen)
|
|||||||
print_date();
|
print_date();
|
||||||
fprintf(stderr, "%s\n", msg);
|
fprintf(stderr, "%s\n", msg);
|
||||||
} else
|
} else
|
||||||
syslog(LOG_DAEMON, "%s", msg);
|
syslog(LOG_DAEMON | imsg->hdr.peerid, "%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user