summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pulse/pulseaudio.h8
-rw-r--r--src/pulsecore/log.c7
2 files changed, 15 insertions, 0 deletions
diff --git a/src/pulse/pulseaudio.h b/src/pulse/pulseaudio.h
index f5c5b0d13..5077e3b81 100644
--- a/src/pulse/pulseaudio.h
+++ b/src/pulse/pulseaudio.h
@@ -140,6 +140,14 @@
* - `PULSE_LOG_SYSLOG`: If defined, force all client libraries to log
* their output using the syslog(3) mechanism. Default behavior is to
* log all output to stderr.
+ * - `PULSE_LOG_JOURNAL`: If defined, force all client libraries to log
+ * their output using the systemd journal. If both `PULSE_LOG_JOURNAL`
+ * and `PULSE_LOG_SYSLOG` are defined, logging to the systemd journal
+ * takes a higher precedence. Each message originating library file name
+ * and function are included by default through the journal fields
+ * `CODE_FILE`, `CODE_FUNC`, and `CODE_LINE`. Any backtrace attached to
+ * the logging message is sent through the PulseAudio-specific journal
+ * field `PULSE_BACKTRACE`.
* - `PULSE_LOG_COLORS`: If defined, enables colored logging output.
* - `PULSE_LOG_TIME`: If defined, include timestamps with each message.
* - `PULSE_LOG_FILE`: If defined, include each message originating file
diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c
index 552d41612..34ed0415f 100644
--- a/src/pulsecore/log.c
+++ b/src/pulsecore/log.c
@@ -60,6 +60,7 @@
#include "log.h"
#define ENV_LOG_SYSLOG "PULSE_LOG_SYSLOG"
+#define ENV_LOG_JOURNAL "PULSE_LOG_JOURNAL"
#define ENV_LOG_LEVEL "PULSE_LOG"
#define ENV_LOG_COLORS "PULSE_LOG_COLORS"
#define ENV_LOG_PRINT_TIME "PULSE_LOG_TIME"
@@ -293,6 +294,11 @@ static void init_defaults(void) {
target_override_set = true;
}
+ if (getenv(ENV_LOG_JOURNAL)) {
+ target_override = PA_LOG_JOURNAL;
+ target_override_set = true;
+ }
+
if ((e = getenv(ENV_LOG_LEVEL))) {
maximum_level_override = (pa_log_level_t) atoi(e);
@@ -493,6 +499,7 @@ void pa_log_levelv_meta(
"CODE_FILE=%s", file,
"CODE_FUNC=%s", func,
"CODE_LINE=%d", line,
+ "PULSE_BACKTRACE=%s", pa_strempty(bt),
NULL) < 0) {
#ifdef HAVE_SYSLOG_H
pa_log_target new_target = { .type = PA_LOG_SYSLOG, .file = NULL };