From e8e581bf256b8c0fbd430935af79fa0e8ee570a1 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Mon, 15 Apr 2013 22:25:58 -0400 Subject: Report about syntax errors with metadata The information about the unit for which files are being parsed is passed all the way down. This way messages land in the journal with proper UNIT=... or USER_UNIT=... attribution. 'systemctl status' and 'journalctl -u' not displaying those messages has been a source of confusion for users, since the journal entry for a misspelt setting was often logged quite a bit earlier than the failure to start a unit. Based-on-a-patch-by: Oleksii Shevchuk --- src/core/unit.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/core/unit.h') diff --git a/src/core/unit.h b/src/core/unit.h index 80a96e8053..a972a31366 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -569,6 +569,8 @@ 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); +/* Macros which append UNIT= or USER_UNIT= to the message */ + #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__) -- cgit v1.2.3-54-g00ecf