chiark / gitweb /
logind: log with AUTH facility
[elogind.git] / src / log.h
index 9942e3e9a05a21ea3dfca659080e2c1faf51d6bd..3283808ff88cbdc3c201d06a96693e598cc4c94b 100644 (file)
--- a/src/log.h
+++ b/src/log.h
 
 #include <syslog.h>
 #include <stdbool.h>
+#include <stdarg.h>
 
 #include "macro.h"
 
-/* If set to SYSLOG and /dev/log can not be opened we fall back to
- * KSMG. If KMSG fails, we fall back to CONSOLE */
 typedef enum LogTarget{
         LOG_TARGET_CONSOLE,
         LOG_TARGET_KMSG,
+        LOG_TARGET_JOURNAL,
+        LOG_TARGET_JOURNAL_OR_KMSG,
         LOG_TARGET_SYSLOG,
         LOG_TARGET_SYSLOG_OR_KMSG,
-        LOG_TARGET_AUTO, /* console if stderr is tty, SYSLOG_OR_KMSG otherwise */
+        LOG_TARGET_AUTO, /* console if stderr is tty, JOURNAL_OR_KMSG otherwise */
         LOG_TARGET_NULL,
         _LOG_TARGET_MAX,
         _LOG_TARGET_INVALID = -1
@@ -42,6 +43,7 @@ typedef enum LogTarget{
 
 void log_set_target(LogTarget target);
 void log_set_max_level(int level);
+void log_set_facility(int facility);
 
 int log_set_target_from_string(const char *e);
 int log_set_max_level_from_string(const char *e);
@@ -60,6 +62,7 @@ void log_close(void);
 void log_forget_fds(void);
 
 void log_close_syslog(void);
+void log_close_journal(void);
 void log_close_kmsg(void);
 void log_close_console(void);
 
@@ -72,11 +75,16 @@ int log_meta(
         const char *func,
         const char *format, ...) _printf_attr_(5,6);
 
-_noreturn_ void log_assert(
+int log_metav(
+        int level,
         const char*file,
         int line,
         const char *func,
-        const char *format, ...) _printf_attr_(4,5);
+        const char *format,
+        va_list ap);
+
+_noreturn_ void log_assert_failed(const char *text, const char *file, int line, const char *func);
+_noreturn_ void log_assert_failed_unreachable(const char *text, const char *file, int line, const char *func);
 
 /* This modifies the buffer passed! */
 int log_dump_internal(
@@ -86,7 +94,7 @@ int log_dump_internal(
         const char *func,
         char *buffer);
 
-#define log_full(level, ...) log_meta(level, __FILE__, __LINE__, __func__, __VA_ARGS__)
+#define log_full(level, ...) log_meta(level,   __FILE__, __LINE__, __func__, __VA_ARGS__)
 
 #define log_debug(...)   log_meta(LOG_DEBUG,   __FILE__, __LINE__, __func__, __VA_ARGS__)
 #define log_info(...)    log_meta(LOG_INFO,    __FILE__, __LINE__, __func__, __VA_ARGS__)