]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/unit: merge use of LOG_CONTEXT_SET_LOG_LEVEL into LOG_CONTEXT_PUSH_UNIT
authorMike Yuan <me@yhndnzj.com>
Wed, 31 Jul 2024 17:51:23 +0000 (19:51 +0200)
committerMike Yuan <me@yhndnzj.com>
Wed, 31 Jul 2024 19:40:28 +0000 (21:40 +0200)
No functional change, since LOG_CONTEXT_PUSH_UNIT is only used
in exec_spawn().

src/core/execute.c
src/core/unit.h

index b909b81e3251ad93477e2fef9bb773e3250f4e8a..959359907fd563df5082cce1c2fe4f3ed2f52f13 100644 (file)
@@ -396,7 +396,6 @@ int exec_spawn(
         assert(ret);
 
         LOG_CONTEXT_PUSH_UNIT(unit);
-        LOG_CONTEXT_SET_LOG_LEVEL(context->log_level_max >= 0 ? context->log_level_max : log_get_max_level());
 
         r = exec_context_load_environment(unit, context, &params->files_env);
         if (r < 0)
index 4c900430b40bf068fa4a8cd366f080ed94282050..115948cd26d77ca914f5349ccf1605fa19fe1f23 100644 (file)
@@ -1189,12 +1189,13 @@ typedef struct UnitForEachDependencyData {
 #define UNIT_FOREACH_DEPENDENCY(other, u, match_atom) \
         _UNIT_FOREACH_DEPENDENCY(other, u, match_atom, UNIQ_T(data, UNIQ))
 
-#define _LOG_CONTEXT_PUSH_UNIT(unit, u, c)                                                      \
-        const Unit *u = (unit);                                                                 \
-        const ExecContext *c = unit_get_exec_context(u);                                        \
-        LOG_CONTEXT_PUSH_KEY_VALUE(u->manager->unit_log_field, u->id);                          \
-        LOG_CONTEXT_PUSH_KEY_VALUE(u->manager->invocation_log_field, u->invocation_id_string);  \
-        LOG_CONTEXT_PUSH_IOV(c ? c->log_extra_fields : NULL, c ? c->n_log_extra_fields : 0)
+#define _LOG_CONTEXT_PUSH_UNIT(unit, u, c)                                                              \
+        const Unit *u = (unit);                                                                         \
+        const ExecContext *c = unit_get_exec_context(u);                                                \
+        LOG_CONTEXT_PUSH_KEY_VALUE(u->manager->unit_log_field, u->id);                                  \
+        LOG_CONTEXT_PUSH_KEY_VALUE(u->manager->invocation_log_field, u->invocation_id_string);          \
+        LOG_CONTEXT_PUSH_IOV(c ? c->log_extra_fields : NULL, c ? c->n_log_extra_fields : 0);            \
+        LOG_CONTEXT_SET_LOG_LEVEL(c->log_level_max >= 0 ? c->log_level_max : log_get_max_level())
 
 #define LOG_CONTEXT_PUSH_UNIT(unit) \
         _LOG_CONTEXT_PUSH_UNIT(unit, UNIQ_T(u, UNIQ), UNIQ_T(c, UNIQ))