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

dion at linutronix.de dion at linutronix.de
Mon Jul 8 17:11:16 CEST 2019


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>
---
 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




More information about the elbe-devel mailing list