core: exec_log_level_max_with_exec_params()

This commit is contained in:
Ivan Kruglov
2025-07-14 02:46:28 -07:00
parent fbfc439438
commit 3064c04473
2 changed files with 9 additions and 4 deletions

View File

@@ -366,13 +366,17 @@ const char* exec_get_private_notify_socket_path(const ExecContext *context, cons
return "/run/host/notify";
}
int exec_log_level_max(const ExecContext *context, const ExecParameters *params) {
assert(context);
int exec_log_level_max_with_exec_params(const ExecContext *context, const ExecParameters *params) {
assert(params);
if (params->debug_invocation)
return LOG_DEBUG;
return exec_log_level_max(context);
}
int exec_log_level_max(const ExecContext *context) {
assert(context);
return context->log_level_max < 0 ? log_get_max_level() : context->log_level_max;
}

View File

@@ -633,7 +633,8 @@ bool exec_is_cgroup_mount_read_only(const ExecContext *context);
const char* exec_get_private_notify_socket_path(const ExecContext *context, const ExecParameters *params, bool needs_sandboxing);
int exec_log_level_max(const ExecContext *context, const ExecParameters *params);
int exec_log_level_max_with_exec_params(const ExecContext *context, const ExecParameters *params);
int exec_log_level_max(const ExecContext *context);
/* These logging macros do the same logging as those in unit.h, but using ExecContext and ExecParameters
* instead of the unit object, so that it can be used in the sd-executor context (where the unit object is
@@ -655,7 +656,7 @@ int exec_log_level_max(const ExecContext *context, const ExecParameters *params)
LOG_CONTEXT_PUSH_KEY_VALUE(LOG_EXEC_ID_FIELD(p), p->unit_id); \
LOG_CONTEXT_PUSH_KEY_VALUE(LOG_EXEC_INVOCATION_ID_FIELD(p), p->invocation_id_string); \
LOG_CONTEXT_PUSH_IOV(c->log_extra_fields, c->n_log_extra_fields) \
LOG_CONTEXT_SET_LOG_LEVEL(exec_log_level_max(c, p)) \
LOG_CONTEXT_SET_LOG_LEVEL(exec_log_level_max_with_exec_params(c, p)) \
LOG_SET_PREFIX(p->unit_id);
#define LOG_CONTEXT_PUSH_EXEC(ec, ep) \