From patchwork Mon Jun 8 07:00:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 28559 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5870Ywd025888 for ; Mon, 8 Jun 2009 07:00:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752108AbZFHHA2 (ORCPT ); Mon, 8 Jun 2009 03:00:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751988AbZFHHA2 (ORCPT ); Mon, 8 Jun 2009 03:00:28 -0400 Received: from mx1.redhat.com ([66.187.233.31]:55412 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751872AbZFHHA1 (ORCPT ); Mon, 8 Jun 2009 03:00:27 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n5870T2w008653; Mon, 8 Jun 2009 03:00:29 -0400 Received: from mail05.corp.redhat.com (zmail05.collab.prod.int.phx2.redhat.com [10.5.5.46]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5870RIr025379; Mon, 8 Jun 2009 03:00:27 -0400 Date: Mon, 8 Jun 2009 03:00:27 -0400 (EDT) From: Michael Goldish To: Lucas Meneghel Rodrigues Cc: kvm@vger.kernel.org, autotest@test.kernel.org Message-ID: <985929792.1402981244444427493.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> In-Reply-To: <1424198121.1402961244444408698.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com> Subject: Re: [Autotest] [PATCH 3/3] Fix bad logging calls MIME-Version: 1.0 X-Originating-IP: [10.5.5.71] X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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" To: autotest@test.kernel.org Cc: kvm@vger.kernel.org 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 --- 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)