[elbe-devel] [PATCH v4 07/41] Add logging to stdout for command buildsdk

dion at linutronix.de dion at linutronix.de
Mon Jul 8 17:11:12 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/buildsdk.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/elbepack/commands/buildsdk.py b/elbepack/commands/buildsdk.py
index 5b4debfc..ce14adc6 100644
--- a/elbepack/commands/buildsdk.py
+++ b/elbepack/commands/buildsdk.py
@@ -7,9 +7,11 @@ from __future__ import print_function
 
 from optparse import OptionParser
 import sys
+import logging
 
 from elbepack.elbeproject import ElbeProject
 from elbepack.elbexml import ValidationError
+from elbepack.log import elbe_logging
 
 
 def run_command(argv):
@@ -28,12 +30,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_sdk()
+        project.build_sdk()
-- 
2.11.0




More information about the elbe-devel mailing list