log: Add support for journal logging
This logging is available if the software was build with the configure option --with-systemd-journal. It will be enabled by default if libsystemd is found. The runtime parameter --log-journal enables to output of log messages to the systemd journal. Please note that the journal priority field has the same value as the syslog level so no conversion is required here.
This commit is contained in:
committed by
Aleksander Morgado
parent
13592c5d2d
commit
fd0bed1df9
@@ -89,6 +89,7 @@ mm_context_get_no_auto_scan (void)
|
||||
|
||||
static const gchar *log_level;
|
||||
static const gchar *log_file;
|
||||
static gboolean log_journal;
|
||||
static gboolean log_show_ts;
|
||||
static gboolean log_rel_ts;
|
||||
|
||||
@@ -103,6 +104,13 @@ static const GOptionEntry log_entries[] = {
|
||||
"Path to log file",
|
||||
"[PATH]"
|
||||
},
|
||||
#if WITH_SYSTEMD_JOURNAL
|
||||
{
|
||||
"log-journal", 0, 0, G_OPTION_ARG_NONE, &log_journal,
|
||||
"Log to systemd journal",
|
||||
NULL
|
||||
},
|
||||
#endif
|
||||
{
|
||||
"log-timestamps", 0, 0, G_OPTION_ARG_NONE, &log_show_ts,
|
||||
"Show timestamps in log output",
|
||||
@@ -142,6 +150,12 @@ mm_context_get_log_file (void)
|
||||
return log_file;
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_context_get_log_journal (void)
|
||||
{
|
||||
return log_journal;
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_context_get_log_timestamps (void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user