X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flog.c;h=3776f0d9d89a920781166c90a15ba66937a93ce6;hp=a2a648a93cc8939f55ea93ed53c939b75cd067c6;hb=114a50f898a89bd7784c215ac5df95ec8c45a905;hpb=f41c094c9fb6760b27996aacfe1e66f2f2f415cb diff --git a/src/log.c b/src/log.c index a2a648a93..3776f0d9d 100644 --- a/src/log.c +++ b/src/log.c @@ -45,7 +45,7 @@ static bool syslog_is_stream = false; static bool show_color = false; static bool show_location = false; -/* Akin to glibc's __abort_msg; which is private and we hance cannot +/* Akin to glibc's __abort_msg; which is private and we hence cannot * use here. */ static char *log_abort_msg = NULL; @@ -74,7 +74,7 @@ static int log_open_console(void) { return console_fd; } - log_debug("Succesfully opened /dev/console for logging."); + log_debug("Successfully opened /dev/console for logging."); } else console_fd = STDERR_FILENO; @@ -100,7 +100,7 @@ static int log_open_kmsg(void) { return -errno; } - log_debug("Succesfully opened /dev/kmsg for logging."); + log_debug("Successfully opened /dev/kmsg for logging."); return 0; } @@ -171,7 +171,7 @@ static int log_open_syslog(void) { } else syslog_is_stream = false; - log_debug("Succesfully opened syslog for logging."); + log_debug("Successfully opened syslog for logging."); return 0; @@ -238,11 +238,11 @@ void log_set_max_level(int level) { } static int write_to_console( - int level, - const char*file, - int line, - const char *func, - const char *buffer) { + int level, + const char*file, + int line, + const char *func, + const char *buffer) { char location[64]; struct iovec iovec[5]; @@ -289,7 +289,7 @@ static int write_to_syslog( if (syslog_fd < 0) return 0; - snprintf(header_priority, sizeof(header_priority), "<%i>", LOG_MAKEPRI(LOG_DAEMON, LOG_PRI(level))); + snprintf(header_priority, sizeof(header_priority), "<%i>", level); char_array_0(header_priority); t = (time_t) (now(CLOCK_REALTIME) / USEC_PER_SEC); @@ -346,7 +346,7 @@ static int write_to_kmsg( if (kmsg_fd < 0) return 0; - snprintf(header_priority, sizeof(header_priority), "<%i>", LOG_PRI(level)); + snprintf(header_priority, sizeof(header_priority), "<%i>", level); char_array_0(header_priority); snprintf(header_pid, sizeof(header_pid), "[%lu]: ", (unsigned long) getpid()); @@ -377,6 +377,10 @@ static int log_dispatch( if (log_target == LOG_TARGET_NULL) return 0; + /* Patch in LOG_DAEMON facility if necessary */ + if ((level & LOG_FACMASK) == 0) + level = LOG_DAEMON | LOG_PRI(level); + do { char *e; int k = 0;