From fdf9f9bbe4dc3281bc8799e2a1f8709776c8cad8 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Sat, 5 Jan 2013 11:59:46 -0500 Subject: journal: new logging macros to include UNIT= Adding UNIT= to log lines allows them to be shown in 'systemctl status' output, etc. A new set of macros and functions is added. This allows for less verbose notation than using log_struct() explicitly. The set of logging functions is expanded to take a pair of arguments (e.g. "UNIT=" and the RHS) which add an extra line to the structured log entry. This can be used to add macros which add a different identifier later on. --- src/core/unit.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/core/unit.h') diff --git a/src/core/unit.h b/src/core/unit.h index 790d3d758e..702bfeece6 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -555,3 +555,10 @@ 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_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__) -- cgit v1.2.3-54-g00ecf