summaryrefslogtreecommitdiff
path: root/src/core/unit.h
diff options
context:
space:
mode:
authorMirco Tischler <mt-ml@gmx.de>2013-01-17 18:55:06 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-01-18 11:14:00 -0500
commitbbc9006e6b5665073149331d75c104a33224dc19 (patch)
tree116572d108aaa170449fa8eb9617980e77a238b6 /src/core/unit.h
parentef1673d16907726d83bdff2e57b5261997a85020 (diff)
core: log USER_UNIT instead of UNIT if in user session
Diffstat (limited to 'src/core/unit.h')
-rw-r--r--src/core/unit.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/unit.h b/src/core/unit.h
index d1ecae74ac..23cd9ef459 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -23,6 +23,7 @@
#include <stdbool.h>
#include <stdlib.h>
+#include <unistd.h>
typedef struct Unit Unit;
typedef struct UnitVTable UnitVTable;
@@ -556,9 +557,11 @@ UnitActiveState unit_active_state_from_string(const char *s);
const char *unit_dependency_to_string(UnitDependency i);
UnitDependency unit_dependency_from_string(const char *s);
-#define log_full_unit(level, unit, ...) log_meta_object(level, __FILE__, __LINE__, __func__, "UNIT=", unit, __VA_ARGS__)
+#define log_full_unit(level, unit, ...) log_meta_object(level, __FILE__, __LINE__, __func__, getpid() == 1 ? "UNIT=" : "USER_UNIT=", unit, __VA_ARGS__)
#define log_debug_unit(unit, ...) log_full_unit(LOG_DEBUG, unit, __VA_ARGS__)
#define log_info_unit(unit, ...) log_full_unit(LOG_INFO, unit, __VA_ARGS__)
#define log_notice_unit(unit, ...) log_full_unit(LOG_NOTICE, unit, __VA_ARGS__)
#define log_warning_unit(unit, ...) log_full_unit(LOG_WARNING, unit, __VA_ARGS__)
#define log_error_unit(unit, ...) log_full_unit(LOG_ERR, unit, __VA_ARGS__)
+
+#define log_struct_unit(level, unit, ...) log_struct(level, getpid() == 1 ? "UNIT=%s" : "USER_UNIT=%s", unit, __VA_ARGS__)