[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/5] iotests: Set up Python logging
From: |
Lukáš Doktor |
Subject: |
Re: [Qemu-devel] [PATCH 2/5] iotests: Set up Python logging |
Date: |
Thu, 28 Sep 2017 10:54:56 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
Dne 27.9.2017 v 15:03 Eduardo Habkost napsal(a):
> Set up Python logging module instead of relying on
> QEMUMachine._debug to enable debugging messages.
>
> Cc: Kevin Wolf <address@hidden>
> Cc: Max Reitz <address@hidden>
> Cc: address@hidden
> Signed-off-by: Eduardo Habkost <address@hidden>
> ---
> tests/qemu-iotests/iotests.py | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 1af117e37d..36a7757aaf 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -28,6 +28,7 @@ import qtest
> import struct
> import json
> import signal
> +import logging
>
>
> # This will not work if arguments contain spaces but is necessary if we
> @@ -467,6 +468,8 @@ def main(supported_fmts=[], supported_oses=['linux']):
> else:
> output = StringIO.StringIO()
>
> + logging.basicConfig(level=(logging.DEBUG if debug else logging.WARN))
> +
Strictly speaking the brackets around ternary operator are not necessary, but
given this is not a python project it's probably fine.
> class MyTestRunner(unittest.TextTestRunner):
> def __init__(self, stream=output, descriptions=True,
> verbosity=verbosity):
> unittest.TextTestRunner.__init__(self, stream, descriptions,
> verbosity)
>
Yes, this is a better solution than the previous logging hotfix.
Reviewed-by: Lukáš Doktor <address@hidden>
signature.asc
Description: OpenPGP digital signature