From af4454cb17da6727e490522afb7d4bddf8dae7fd Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 9 Jan 2020 17:03:57 +0100
Subject: [PATCH] core: use unit-based logging instead of generic logging where
 appropriate

---
 src/core/swap.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/core/swap.c b/src/core/swap.c
index 6caf20ea66..d4f6db6ddc 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -768,9 +768,9 @@ static void swap_enter_activating(Swap *s) {
 
                 r = fstab_find_pri(s->parameters_fragment.options, &priority);
                 if (r < 0)
-                        log_warning_errno(r, "Failed to parse swap priority \"%s\", ignoring: %m", s->parameters_fragment.options);
-                else if (r == 1 && s->parameters_fragment.priority_set)
-                        log_warning("Duplicate swap priority configuration by Priority and Options fields.");
+                        log_unit_warning_errno(UNIT(s), r, "Failed to parse swap priority \"%s\", ignoring: %m", s->parameters_fragment.options);
+                else if (r > 0 && s->parameters_fragment.priority_set)
+                        log_unit_warning(UNIT(s), "Duplicate swap priority configuration by Priority= and Options= fields.");
 
                 if (r <= 0 && s->parameters_fragment.priority_set) {
                         if (s->parameters_fragment.options)
@@ -788,7 +788,7 @@ static void swap_enter_activating(Swap *s) {
 
         if (s->parameters_fragment.options || opts) {
                 r = exec_command_append(s->control_command, "-o",
-                                opts ? : s->parameters_fragment.options, NULL);
+                                opts ?: s->parameters_fragment.options, NULL);
                 if (r < 0)
                         goto fail;
         }
@@ -804,7 +804,6 @@ static void swap_enter_activating(Swap *s) {
                 goto fail;
 
         swap_set_state(s, SWAP_ACTIVATING);
-
         return;
 
 fail:
-- 
2.23.0

