summaryrefslogtreecommitdiff
path: root/buildstream/_context.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/_context.py')
-rw-r--r--buildstream/_context.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/buildstream/_context.py b/buildstream/_context.py
index 332b2c020..3f5a4d62f 100644
--- a/buildstream/_context.py
+++ b/buildstream/_context.py
@@ -343,6 +343,19 @@ class Context():
self._message_handler(message, context=self)
return
+ # _silence()
+ #
+ # A context manager to silence messages, this behaves in
+ # the same way as the `silent_nested` argument of the
+ # Context._timed_activity() context manager: especially
+ # important messages will not be silenced.
+ #
+ @contextmanager
+ def _silence(self):
+ self._push_message_depth(True)
+ yield
+ self._pop_message_depth()
+
# _timed_activity()
#
# Context manager for performing timed activities and logging those