execute: Get rid of custom logging macros

We already have LOG_CONTEXT_PUSH_EXEC() which with two additions
does exactly the same as the custom logging macros, so let's get rid
of the custom logging macros and use LOG_CONTEXT_PUSH_EXEC() instead.
This commit is contained in:
Daan De Meyer
2025-04-23 14:48:45 +02:00
parent a94d0e3177
commit 44d50ba88e
3 changed files with 281 additions and 449 deletions
+7 -5
View File
@@ -240,6 +240,8 @@ static int run(int argc, char *argv[]) {
if (r < 0)
return log_error_errno(r, "Failed to deserialize: %m");
LOG_CONTEXT_PUSH_EXEC(&context, &params);
arg_serialization = safe_fclose(arg_serialization);
fdset = fdset_free(fdset);
@@ -253,11 +255,11 @@ static int run(int argc, char *argv[]) {
const char *status = ASSERT_PTR(
exit_status_to_string(exit_status, EXIT_STATUS_LIBC | EXIT_STATUS_SYSTEMD));
log_exec_struct_errno(&context, &params, LOG_ERR, r,
LOG_MESSAGE_ID(SD_MESSAGE_SPAWN_FAILED_STR),
LOG_EXEC_MESSAGE(&params, "Failed at step %s spawning %s: %m",
status, command.path),
LOG_ITEM("EXECUTABLE=%s", command.path));
log_struct_errno(LOG_ERR, r,
LOG_MESSAGE_ID(SD_MESSAGE_SPAWN_FAILED_STR),
LOG_EXEC_MESSAGE(&params, "Failed at step %s spawning %s: %m",
status, command.path),
LOG_ITEM("EXECUTABLE=%s", command.path));
} else
/* r == 0: 'skip' is chosen in the confirm spawn prompt
* r > 0: expected/ignored failure, do not log at error level */