Optionally call printf on LOG_MESSAGE() arguments
With an intentional mistake:
../src/login/logind-dbus.c: In function ‘bus_manager_log_shutdown’:
../src/login/logind-dbus.c:1542:39: error: format ‘%s’ expects a matching ‘char *’ argument [-Werror=format=]
1542 | LOG_MESSAGE("%s %s", message),
| ^~~~~~~
This commit is contained in:
+2
-1
@@ -1046,7 +1046,8 @@ Condition *unit_find_failed_condition(Unit *u);
|
||||
|
||||
#define log_unit_struct_iovec(unit, level, iovec, n_iovec) log_unit_struct_iovec_errno(unit, level, 0, iovec, n_iovec)
|
||||
|
||||
#define LOG_UNIT_MESSAGE(unit, fmt, ...) "MESSAGE=%s: " fmt, (unit)->id, ##__VA_ARGS__
|
||||
/* Like LOG_MESSAGE(), but with the unit name prefixed. */
|
||||
#define LOG_UNIT_MESSAGE(unit, fmt, ...) LOG_MESSAGE("%s: " fmt, (unit)->id, ##__VA_ARGS__)
|
||||
#define LOG_UNIT_ID(unit) (unit)->manager->unit_log_format_string, (unit)->id
|
||||
#define LOG_UNIT_INVOCATION_ID(unit) (unit)->manager->invocation_log_format_string, (unit)->invocation_id_string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user