[bitbake-devel,04/15] bitbake: lib/bb/msg.py: Add repr for BBLogFormatter

Submitted by Joshua Watt on March 9, 2020, 4:33 p.m. | Patch ID: 170915

Details

Message ID 20200309163353.15362-5-JPEWhacker@gmail.com
State New
Headers show

Commit Message

Joshua Watt March 9, 2020, 4:33 p.m.
Adds a __repr__ function for BBLogFormatter. This allows it to get a
human readable string when printed using the logging_tree module

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 bitbake/lib/bb/msg.py | 3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
index ea6a9543f7..c70fd80806 100644
--- a/bitbake/lib/bb/msg.py
+++ b/bitbake/lib/bb/msg.py
@@ -98,6 +98,9 @@  class BBLogFormatter(logging.Formatter):
     def enable_color(self):
         self.color_enabled = True
 
+    def __repr__(self):
+        return "%s fmt='%s' color=%s" % (self.__class__.__name__, self._fmt, "True" if self.color_enabled else "False")
+
 class BBLogFilter(object):
     def __init__(self, handler, level, debug_domains):
         self.stdlevel = level