[elbe-devel] [PATCH v4 08/41] Add logging to stdout for command buildsysroot

Torben Hohn torben.hohn at linutronix.de
Wed Aug 7 12:15:32 CEST 2019


On Mon, Jul 08, 2019 at 05:11:13PM +0200, dion at linutronix.de wrote:
> From: Olivier Dion <dion at linutronix.de>
> 
> make use of the new logging system, and replace all print() with
> functions from logging and wrap it in
> "with elbe_logging({"streams":sys.stdout}):"
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>

Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>

> ---
>  elbepack/commands/buildsysroot.py | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/elbepack/commands/buildsysroot.py b/elbepack/commands/buildsysroot.py
> index 3dc8e38a..ffcb611d 100644
> --- a/elbepack/commands/buildsysroot.py
> +++ b/elbepack/commands/buildsysroot.py
> @@ -7,11 +7,13 @@
>  
>  from __future__ import print_function
>  
> +import logging
>  from optparse import OptionParser
>  import sys
>  
>  from elbepack.elbeproject import ElbeProject
>  from elbepack.elbexml import ValidationError
> +from elbepack.log import elbe_logging
>  
>  
>  def run_command(argv):
> @@ -30,12 +32,12 @@ def run_command(argv):
>          oparser.print_help()
>          sys.exit(20)
>  
> -    try:
> -        project = ElbeProject(args[0], override_buildtype=opt.buildtype,
> -                              skip_validate=opt.skip_validation)
> -    except ValidationError as e:
> -        print(str(e))
> -        print("xml validation failed. Bailing out")
> -        sys.exit(20)
> +    with elbe_logging({"streams":sys.stdout}):
> +        try:
> +            project = ElbeProject(args[0], override_buildtype=opt.buildtype,
> +                                  skip_validate=opt.skip_validation)
> +        except ValidationError:
> +            logging.exception("XML validation failed.  Bailing out")
> +            sys.exit(20)
>  
> -    project.build_sysroot()
> +        project.build_sysroot()
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list