summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/msg.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-26 16:55:35 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-27 10:17:20 +0000
commitcf9777339453d0920bbd07e512b448ce3a5c1168 (patch)
tree16f74eb81b616b2df056911d9b6f00b6fd1144d7 /bitbake/lib/bb/msg.py
parent18bbfc4cf32b3ed564f93efef16a391c5a3ae50f (diff)
downloadpoky-cf9777339453d0920bbd07e512b448ce3a5c1168.tar.gz
bitbake: msg: Add stdout/stderr filters
Add logging filters which can be used to split output between stdout and stderr, ERROR messages and above as passed by the Err filter, anything below ERROR is passed by the Out filter. This is useful when trying to make stderr more useful. (Bitbake rev: d3e1419ef76be5e9ec976597361a5e14a7b6bcb6) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/msg.py')
-rw-r--r--bitbake/lib/bb/msg.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
index 59769707e0..d79768db24 100644
--- a/bitbake/lib/bb/msg.py
+++ b/bitbake/lib/bb/msg.py
@@ -126,7 +126,21 @@ class BBLogFilter(object):
126 return True 126 return True
127 return False 127 return False
128 128
129class BBLogFilterStdErr(BBLogFilter):
130 def filter(self, record):
131 if not BBLogFilter.filter(self, record):
132 return False
133 if record.levelno >= logging.ERROR:
134 return True
135 return False
129 136
137class BBLogFilterStdOut(BBLogFilter):
138 def filter(self, record):
139 if not BBLogFilter.filter(self, record):
140 return False
141 if record.levelno < logging.ERROR:
142 return True
143 return False
130 144
131# Message control functions 145# Message control functions
132# 146#
@@ -164,10 +178,10 @@ def constructLogOptions():
164 debug_domains["BitBake.%s" % domainarg] = logging.DEBUG - dlevel + 1 178 debug_domains["BitBake.%s" % domainarg] = logging.DEBUG - dlevel + 1
165 return level, debug_domains 179 return level, debug_domains
166 180
167def addDefaultlogFilter(handler): 181def addDefaultlogFilter(handler, cls = BBLogFilter):
168 level, debug_domains = constructLogOptions() 182 level, debug_domains = constructLogOptions()
169 183
170 BBLogFilter(handler, level, debug_domains) 184 cls(handler, level, debug_domains)
171 185
172# 186#
173# Message handling functions 187# Message handling functions