summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-08-24 22:43:33 +0200
committerLennart Poettering <lennart@poettering.net>2012-09-03 18:59:04 -0700
commit81270860a5b8c6794f0c7bac8becfdd0c41a9385 (patch)
tree33d6c9acf4c6b1f6881c777309f02aec7ea33625 /src/shared
parent877d54e9b09e093c2102f519a84e2a52637ae035 (diff)
journal: suppress structured messages if they'd go to the console
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/log.c7
-rw-r--r--src/shared/log.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/src/shared/log.c b/src/shared/log.c
index 67a3e1b843..847202d7d3 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -859,6 +859,13 @@ int log_show_location_from_string(const char *e) {
return 0;
}
+bool log_on_console(void) {
+ if (log_target == LOG_TARGET_CONSOLE)
+ return true;
+
+ return syslog_fd < 0 && kmsg_fd < 0 && journal_fd < 0;
+}
+
static const char *const log_target_table[] = {
[LOG_TARGET_CONSOLE] = "console",
[LOG_TARGET_KMSG] = "kmsg",
diff --git a/src/shared/log.h b/src/shared/log.h
index 0c60b7671b..c242cc219f 100644
--- a/src/shared/log.h
+++ b/src/shared/log.h
@@ -131,5 +131,7 @@ _noreturn_ void log_assert_failed_unreachable(
/* This modifies the buffer passed! */
#define log_dump(level, buffer) log_dump_internal(level, __FILE__, __LINE__, __func__, buffer)
+bool log_on_console(void);
+
const char *log_target_to_string(LogTarget target);
LogTarget log_target_from_string(const char *s);