Re: [Autotest] [PATCH 3/3] Fix bad logging calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



format_str_for_message() is meant to be appended to the end of a string, with no spaces or newlines immediately preceding it -- its job is to add spaces or newlines as necessary.

So instead of:

            logging.debug("Timeout elapsed or process terminated. Output: %s",
                          format_str_for_message(data.strip()))

it should be slightly better to use:

            logging.debug("Timeout elapsed or process terminated. Output:%s",
                          format_str_for_message(data.strip()))

but I personally prefer:

            logging.debug("Timeout elapsed or process terminated. Output:" +
                          format_str_for_message(data.strip()))

because I think it looks slightly cleaner ('%s' usually comes with a space before it) --
but that's just an opinion.

Thanks,
Michael

----- Original Message -----
From: "Lucas Meneghel Rodrigues" <lmr@xxxxxxxxxx>
To: autotest@xxxxxxxxxxxxxxx
Cc: kvm@xxxxxxxxxxxxxxx
Sent: Monday, June 8, 2009 7:04:30 AM (GMT+0200) Auto-Detected
Subject: [Autotest] [PATCH 3/3] Fix bad logging calls

During the conversion of kvm autotest to upstream coding standards,
some bad logging calls were left behind. This patch fixes them.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@xxxxxxxxxx>
---
 client/tests/kvm/kvm_utils.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index 434190d..37a1f22 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -304,7 +304,7 @@ class kvm_spawn:
 
         # Print some debugging info
         if match == None and self.poll() != 0:
-            logging.debug("Timeout elapsed or process terminated. Output:",
+            logging.debug("Timeout elapsed or process terminated. Output: %s",
                           format_str_for_message(data.strip()))
 
         return (match, data)
@@ -465,8 +465,8 @@ class kvm_spawn:
 
         # Print some debugging info
         if status != 0:
-            logging.debug("Command failed; status: %d, output:" % status \
-                    + format_str_for_message(output.strip()))
+            logging.debug("Command failed; status: %d, output: %s", status,
+                          format_str_for_message(output.strip()))
 
         return (status, output)
 
-- 
1.6.2.2

_______________________________________________
Autotest mailing list
Autotest@xxxxxxxxxxxxxxx
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux