<itemizedlist>
<listitem><para><parameter moreinfo="none">syslog</parameter></para></listitem>
<listitem><para><parameter moreinfo="none">file</parameter></para></listitem>
+ <listitem><para><parameter moreinfo="none">systemd</parameter></para></listitem>
</itemizedlist>
</description>
.fd = 2 /* stderr by default */
};
-#ifdef WITH_SYSLOG
+#if defined(WITH_SYSLOG) || defined(HAVE_SYSTEMD_JOURNAL)
static int debug_level_to_priority(int level)
{
/*
}
#endif /* WITH_SYSLOG */
+#ifdef HAVE_SYSTEMD_JOURNAL
+#include <systemd/sd-journal.h>
+static void debug_systemd_log(int msg_level,
+ const char *msg, const char *msg_no_nl)
+{
+ sd_journal_send("MESSAGE=%s", msg_no_nl,
+ "PRIORITY=%d", debug_level_to_priority(msg_level),
+ "LEVEL=%d", msg_level,
+ NULL);
+}
+#endif
+
static struct debug_backend {
const char *name;
int log_level;
.log = debug_syslog_log,
},
#endif
+
+#ifdef HAVE_SYSTEMD_JOURNAL
+ {
+ .name = "systemd",
+ .log = debug_systemd_log,
+ },
+#endif
};
static struct debug_backend *debug_find_backend(const char *name)
bld.SAMBA_LIBRARY('samba-debug',
source='debug.c',
deps='replace time-basic close-low-fd talloc socket-blocking',
+ public_deps='systemd-journal',
local_include=False,
private_library=True)
else:
conf.SET_TARGET_TYPE('systemd-daemon', 'EMPTY')
conf.undefine('HAVE_SYSTEMD')
+
+if Options.options.enable_systemd != False:
+ conf.check_cfg(package='libsystemd-journal', args='--cflags --libs',
+ msg='Checking for libsystemd-journal',
+ uselib_store="SYSTEMD-JOURNAL")
+ conf.CHECK_HEADERS('systemd/sd-journal.h', lib='systemd-journal')
+ conf.CHECK_LIB('systemd-journal', shlib=True)
+
+if (conf.CONFIG_SET('HAVE_SYSTEMD_SD_JOURNAL_H') and
+ conf.CONFIG_SET('HAVE_LIBSYSTEMD_JOURNAL')):
+ conf.DEFINE('HAVE_SYSTEMD_JOURNAL', '1')
+else:
+ conf.SET_TARGET_TYPE('systemd-journal', 'EMPTY')
+ conf.undefine('HAVE_SYSTEMD_JOURNAL')