summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/msg.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
index c70fd80806..8561826a6e 100644
--- a/bitbake/lib/bb/msg.py
+++ b/bitbake/lib/bb/msg.py
@@ -135,6 +135,28 @@ class BBLogFilterStdOut(BBLogFilter):
135 return True 135 return True
136 return False 136 return False
137 137
138class LogFilterGEQLevel(logging.Filter):
139 def __init__(self, level):
140 self.strlevel = str(level)
141 self.level = stringToLevel(level)
142
143 def __repr__(self):
144 return "%s level >= %s (%d)" % (self.__class__.__name__, self.strlevel, self.level)
145
146 def filter(self, record):
147 return (record.levelno >= self.level)
148
149class LogFilterLTLevel(logging.Filter):
150 def __init__(self, level):
151 self.strlevel = str(level)
152 self.level = stringToLevel(level)
153
154 def __repr__(self):
155 return "%s level < %s (%d)" % (self.__class__.__name__, self.strlevel, self.level)
156
157 def filter(self, record):
158 return (record.levelno < self.level)
159
138# Message control functions 160# Message control functions
139# 161#
140 162
@@ -175,6 +197,19 @@ def addDefaultlogFilter(handler, cls = BBLogFilter, forcelevel=None):
175 197
176 cls(handler, level, debug_domains) 198 cls(handler, level, debug_domains)
177 199
200def stringToLevel(level):
201 try:
202 return int(level)
203 except ValueError:
204 pass
205
206 try:
207 return getattr(logging, level)
208 except AttributeError:
209 pass
210
211 return getattr(BBLogFormatter, level)
212
178# 213#
179# Message handling functions 214# Message handling functions
180# 215#