Dne 27.9.2017 v 15:03 Eduardo Habkost napsal(a):
> The logging module will eventually replace the 'debug' parameter
> in QEMUMachine and QEMUMonitorProtocol.
> 
> Cc: Daniel P. Berrange <berra...@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabk...@redhat.com>
> ---
>  tests/migration/guestperf/shell.py | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tests/migration/guestperf/shell.py 
> b/tests/migration/guestperf/shell.py
> index 7992459a97..e378cf0cfa 100644
> --- a/tests/migration/guestperf/shell.py
> +++ b/tests/migration/guestperf/shell.py
> @@ -26,6 +26,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__),
>  import argparse
>  import fnmatch
>  import platform
> +import logging
>  
>  from guestperf.hardware import Hardware
>  from guestperf.engine import Engine
> @@ -64,6 +65,11 @@ class BaseShell(object):
>  
>          self._parser = parser
>  
> +    def init_logging(self, args):
> +        logging.basicConfig(level=(logging.DEBUG if args.debug else
> +                                   logging.INFO if args.verbose else
> +                                   logging.WARN))
> +
>      def get_engine(self, args):
>          return Engine(binary=args.binary,
>                        dst_host=args.dst_host,
> @@ -147,6 +153,7 @@ class Shell(BaseShell):
>  
>      def run(self, argv):
>          args = self._parser.parse_args(argv)
> +        self.init_logging(args)
>  
>          engine = self.get_engine(args)
>          hardware = self.get_hardware(args)
> @@ -179,6 +186,7 @@ class BatchShell(BaseShell):
>  
>      def run(self, argv):
>          args = self._parser.parse_args(argv)
> +        self.init_logging(args)
>  
>          engine = self.get_engine(args)
>          hardware = self.get_hardware(args)
> @@ -231,6 +239,7 @@ class PlotShell(object):
>  
>      def run(self, argv):
>          args = self._parser.parse_args(argv)

This class is not inherited from the `BaseShell`, therefor it does not contain 
`init_logging` method. Apart from this it looks good.

> +        self.init_logging(args)
>  
>          if len(args.reports) == 0:
>              print >>sys.stderr, "At least one report required"
> 


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to