From: Eduardo Habkost <ehabkost@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org, "Lukáš Doktor" <ldoktor@redhat.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [Qemu-devel] [PATCH 3/5] basevm: Call logging.basicConfig()
Date: Wed, 27 Sep 2017 10:40:28 -0300 [thread overview]
Message-ID: <20170927134028.GF4115@localhost.localdomain> (raw)
In-Reply-To: <20170927133544.GC8521@lemon.lan>
On Wed, Sep 27, 2017 at 09:35:44PM +0800, Fam Zheng wrote:
> On Wed, 09/27 10:03, Eduardo Habkost wrote:
> > Just setting level=DEBUG when debug is enabled is not enough: we
> > need to set up a log handler if we want debug messages generated
> > using logging.getLogger(...).debug() to be printed.
> >
> > This was not a problem before because logging.debug() calls
> > logging.basicConfig() implicitly, but it's safer to not rely on
> > that.
> >
> > Cc: "Alex Bennée" <alex.bennee@linaro.org>
> > Cc: Fam Zheng <famz@redhat.com>
> > Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> > tests/vm/basevm.py | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> > index 3c863bc237..686d88decf 100755
> > --- a/tests/vm/basevm.py
> > +++ b/tests/vm/basevm.py
> > @@ -227,8 +227,8 @@ def main(vmcls):
> > if not argv and not args.build_qemu and not args.build_image:
> > print "Nothing to do?"
> > return 1
> > - if args.debug:
> > - logging.getLogger().setLevel(logging.DEBUG)
> > + logging.basicConfig(level=(logging.DEBUG if args.debug
> > + else logging.WARN))
>
> I find the " ? : " expression in C more readable than this in Python. :)
I think everybody except Guido does. :)
--
Eduardo
next prev parent reply other threads:[~2017-09-27 13:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-27 13:03 [Qemu-devel] [PATCH 0/5] scripts: Remove 'debug' parameter from QEMUMachine & QEMUMonitorProtocol Eduardo Habkost
2017-09-27 13:03 ` [Qemu-devel] [PATCH 1/5] guestperf: Configure logging on all shell frontends Eduardo Habkost
2017-09-27 13:17 ` Daniel P. Berrange
2017-09-28 9:15 ` Lukáš Doktor
2017-09-28 13:19 ` Eduardo Habkost
2017-09-27 13:03 ` [Qemu-devel] [PATCH 2/5] iotests: Set up Python logging Eduardo Habkost
2017-09-27 13:17 ` Daniel P. Berrange
2017-09-28 8:54 ` Lukáš Doktor
2017-09-27 13:03 ` [Qemu-devel] [PATCH 3/5] basevm: Call logging.basicConfig() Eduardo Habkost
2017-09-27 13:19 ` Daniel P. Berrange
2017-09-27 13:35 ` Fam Zheng
2017-09-27 13:40 ` Eduardo Habkost [this message]
2017-09-28 9:24 ` Lukáš Doktor
2017-09-27 13:03 ` [Qemu-devel] [PATCH 4/5] scripts: Remove debug parameter from QEMUMonitorProtocol Eduardo Habkost
2017-09-27 13:20 ` Daniel P. Berrange
2017-09-27 13:33 ` Fam Zheng
2017-09-27 13:41 ` Eduardo Habkost
2017-09-27 13:44 ` [Qemu-devel] [PATCH] fixup! " Eduardo Habkost
2017-09-28 9:33 ` Lukáš Doktor
2017-09-28 14:01 ` Eduardo Habkost
2017-09-27 13:03 ` [Qemu-devel] [PATCH 5/5] scripts: Remove debug parameter from QEMUMachine Eduardo Habkost
2017-09-27 13:22 ` Daniel P. Berrange
2017-09-27 13:38 ` Eduardo Habkost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170927134028.GF4115@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=crosa@redhat.com \
--cc=f4bug@amsat.org \
--cc=famz@redhat.com \
--cc=ldoktor@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).