diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-23 16:16:50 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-26 10:39:00 +0100 |
commit | ba5a6c88785d9889d4172ec79937ac2a5555327e (patch) | |
tree | 8c80c4af65efc8015e162e8b8a3d650befd0c184 /lib/bb/event.py | |
parent | 8c01cff94787abbb64fbdf0c16cd63f8f97a7e03 (diff) | |
download | bitbake-contrib-ba5a6c88785d9889d4172ec79937ac2a5555327e.tar.gz |
bitbake: Add ui event handlers filtering
Add functionality to allow UIs to update and change the types of events they
recieve. To do this we need to add a new command and also need to be able
to obtain the current event hander ID. In the case of xmlrpc, this is
straightforward, in the case of the process server we need to save the result
in a multiprocessing.Value() so we can retrive it. An excplit command
was added to the server API to facilitate this.
The same function can also be used to mask or unmask specific log messages,
allowing the UI to optionally differ from the standard set of message
filtering.
Based upon work by Cristiana Voicu <cristiana.voicu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/event.py')
-rw-r--r-- | lib/bb/event.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/bb/event.py b/lib/bb/event.py index 8ffd2c3e1..1169cbfb2 100644 --- a/lib/bb/event.py +++ b/lib/bb/event.py @@ -193,7 +193,7 @@ def register(name, handler, mask=[]): else: _handlers[name] = handler - if not mask: + if not mask or '*' in mask: _catchall_handlers[name] = True else: for m in mask: @@ -225,7 +225,7 @@ class UIEventFilter(object): self.update(None, level, debug_domains) def update(self, eventmask, level, debug_domains): - self.eventmask = None + self.eventmask = eventmask self.stdlevel = level self.debug_domains = debug_domains @@ -236,9 +236,20 @@ class UIEventFilter(object): if event.name in self.debug_domains and event.levelno >= self.debug_domains[event.name]: return True return False - # Implement other event masking here on self.eventmask + eid = str(event.__class__)[8:-2] + if eid not in self.eventmask: + return False return True +def set_UIHmask(handlerNum, level, debug_domains, mask): + if not handlerNum in _ui_handlers: + return False + if '*' in mask: + _ui_logfilters[handlerNum].update(None, level, debug_domains) + else: + _ui_logfilters[handlerNum].update(mask, level, debug_domains) + return True + def getName(e): """Returns the name of a class or class instance""" if getattr(e, "__name__", None) == None: |