diff mbox series

[U-Boot,v2,27/31] binman: Allow for logging information to be displayed

Message ID 20190708202553.225715-28-sjg@chromium.org
State Accepted
Commit eea264ead3ca198ed66f62a78dc4940075621ae7
Delegated to: Simon Glass
Headers show
Series binman: Allow reading of images to list contents | expand

Commit Message

Simon Glass July 8, 2019, 8:25 p.m. UTC
Binman generally operates silently but in some cases it is useful to see
what Binman is actually doing at each step. Enable some logging output
with different logging levels selectable via the -v flag.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 tools/binman/README   | 19 ++++++++++++++++++-
 tools/binman/entry.py |  3 ++-
 tools/binman/image.py |  3 ++-
 tools/patman/tout.py  | 10 +++++++++-
 4 files changed, 31 insertions(+), 4 deletions(-)

Comments

Simon Glass July 18, 2019, 1:58 a.m. UTC | #1
Binman generally operates silently but in some cases it is useful to see
what Binman is actually doing at each step. Enable some logging output
with different logging levels selectable via the -v flag.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 tools/binman/README   | 19 ++++++++++++++++++-
 tools/binman/entry.py |  3 ++-
 tools/binman/image.py |  3 ++-
 tools/patman/tout.py  | 10 +++++++++-
 4 files changed, 31 insertions(+), 4 deletions(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/README b/tools/binman/README
index 146e0fd470a..1655a9d50df 100644
--- a/tools/binman/README
+++ b/tools/binman/README
@@ -533,6 +533,24 @@  or with wildcards:
       image-header          bf8     8  image-header     bf8
 
 
+Logging
+-------
+
+Binman normally operates silently unless there is an error, in which case it
+just displays the error. The -D/--debug option can be used to create a full
+backtrace when errors occur.
+
+Internally binman logs some output while it is running. This can be displayed
+by increasing the -v/--verbosity from the default of 1:
+
+   0: silent
+   1: warnings only
+   2: notices (important messages)
+   3: info about major operations
+   4: detailed information about each operation
+   5: debug (all output)
+
+
 Hashing Entries
 ---------------
 
@@ -868,7 +886,6 @@  Some ideas:
 - Add an option to decode an image into the constituent binaries
 - Support building an image for a board (-b) more completely, with a
   configurable build directory
-- Support logging of binman's operations, with different levels of verbosity
 - Support updating binaries in an image (with no size change / repacking)
 - Support updating binaries in an image (with repacking)
 - Support adding FITs to an image
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index c45a2fdb4b0..33d3f1e4d42 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -23,6 +23,7 @@  import sys
 import fdt_util
 import state
 import tools
+import tout
 
 modules = {}
 
@@ -272,7 +273,7 @@  class Entry(object):
         new_size = len(data)
         if state.AllowEntryExpansion():
             if new_size > self.contents_size:
-                print("Entry '%s' size change from %#x to %#x" % (
+                tout.Debug("Entry '%s' size change from %#x to %#x" % (
                     self._node.path, self.contents_size, new_size))
                 # self.data will indicate the new size needed
                 size_ok = False
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 2c5668e2a96..bbb5e23c3b2 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -20,6 +20,7 @@  from etype import section
 import fdt
 import fdt_util
 import tools
+import tout
 
 class Image(section.Entry_section):
     """A Image, representing an output from binman
@@ -107,7 +108,7 @@  class Image(section.Entry_section):
         for entry in self._entries.values():
             if not entry.ProcessContents():
                 sizes_ok = False
-                print("Entry '%s' size change" % self._node.path)
+                tout.Debug("Entry '%s' size change" % self._node.path)
         return sizes_ok
 
     def WriteSymbols(self):
diff --git a/tools/patman/tout.py b/tools/patman/tout.py
index 4957c7ae1df..15acce28cb9 100644
--- a/tools/patman/tout.py
+++ b/tools/patman/tout.py
@@ -131,13 +131,21 @@  def Info(msg):
     """
     _Output(3, msg)
 
+def Detail(msg):
+    """Display a detailed message
+
+    Args:
+        msg; Message to display.
+    """
+    _Output(4, msg)
+
 def Debug(msg):
     """Display a debug message
 
     Args:
         msg; Message to display.
     """
-    _Output(4, msg)
+    _Output(5, msg)
 
 def UserOutput(msg):
     """Display a message regardless of the current output level.