[elbe-devel] [PATCH v4 11/41] Add logging to stdout for command genlicense

Torben Hohn torben.hohn at linutronix.de
Wed Aug 7 11:58:19 CEST 2019


On Mon, Jul 08, 2019 at 05:11:16PM +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/genlicence.py | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/elbepack/commands/genlicence.py b/elbepack/commands/genlicence.py
> index 40f9805b..15db4c46 100644
> --- a/elbepack/commands/genlicence.py
> +++ b/elbepack/commands/genlicence.py
> @@ -11,8 +11,8 @@ import sys
>  import os
>  import io
>  
> -from elbepack.asciidoclog import StdoutLog
>  from elbepack.efilesystem import ElbeFilesystem
> +from elbepack.log import elbe_logging
>  
>  
>  def run_command(argv):
> @@ -31,13 +31,13 @@ def run_command(argv):
>  
>      chroot = os.path.abspath(args[0])
>  
> -    rfs = ElbeFilesystem(chroot)
> -    log = StdoutLog()
> +    with elbe_logging({"streams":sys.stdout}):
> +        rfs = ElbeFilesystem(chroot)
>  
> -    if opt.output:
> -        f = io.open(opt.output, "w+", encoding='utf-8')
> -    else:
> -        f = io.open('licence.txt', "w+", encoding='utf-8')
> +        if opt.output:
> +            f = io.open(opt.output, "w+", encoding='utf-8')
> +        else:
> +            f = io.open('licence.txt', "w+", encoding='utf-8')
>  
> -    rfs.write_licenses(f, log, opt.xml)
> -    f.close()
> +        rfs.write_licenses(f, log, opt.xml)
> +        f.close()
> -- 
> 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