summaryrefslogtreecommitdiff
path: root/src/journal/journal-send.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-12-17 01:32:49 +0100
committerLennart Poettering <lennart@poettering.net>2011-12-17 01:32:49 +0100
commitd0bbc21caa6e68693a47db60c93e99422bf2a858 (patch)
tree7fb96cbcc2d59873397de8d90a1b3f2f8b637721 /src/journal/journal-send.c
parentcab8ac60837b489b27a247990f741315c71cb389 (diff)
journal: introduce mandatory sd_journal_printf() priority parameter
Diffstat (limited to 'src/journal/journal-send.c')
-rw-r--r--src/journal/journal-send.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
index e2575a9805..238d64c13e 100644
--- a/src/journal/journal-send.c
+++ b/src/journal/journal-send.c
@@ -52,30 +52,33 @@ retry:
return fd;
}
-int sd_journal_print(const char *format, ...) {
+int sd_journal_print(int priority, const char *format, ...) {
int r;
va_list ap;
va_start(ap, format);
- r = sd_journal_printv(format, ap);
+ r = sd_journal_printv(priority, format, ap);
va_end(ap);
return r;
}
-int sd_journal_printv(const char *format, va_list ap) {
- char buffer[8 + LINE_MAX];
- struct iovec iov;
+int sd_journal_printv(int priority, const char *format, va_list ap) {
+ char buffer[8 + LINE_MAX], p[11];
+ struct iovec iov[2];
+
+ snprintf(p, sizeof(p), "PRIORITY=%i", priority & LOG_PRIMASK);
+ char_array_0(p);
memcpy(buffer, "MESSAGE=", 8);
vsnprintf(buffer+8, sizeof(buffer) - 8, format, ap);
-
char_array_0(buffer);
zero(iov);
- IOVEC_SET_STRING(iov, buffer);
+ IOVEC_SET_STRING(iov[0], buffer);
+ IOVEC_SET_STRING(iov[1], p);
- return sd_journal_sendv(&iov, 1);
+ return sd_journal_sendv(iov, 2);
}
int sd_journal_send(const char *format, ...) {