Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1465)

Side by Side Diff: build/android/pylib/utils/logging_utils.py

Issue 2101243005: Add a snapshot of flutter/engine/src/build to our sdk (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add README.dart Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import contextlib
6 import logging
7
8 @contextlib.contextmanager
9 def SuppressLogging(level=logging.ERROR):
10 """Momentarilly suppress logging events from all loggers.
11
12 TODO(jbudorick): This is not thread safe. Log events from other threads might
13 also inadvertently dissapear.
14
15 Example:
16
17 with logging_utils.SuppressLogging():
18 # all but CRITICAL logging messages are suppressed
19 logging.info('just doing some thing') # not shown
20 logging.critical('something really bad happened') # still shown
21
22 Args:
23 level: logging events with this or lower levels are suppressed.
24 """
25 logging.disable(level)
26 yield
27 logging.disable(logging.NOTSET)
OLDNEW
« no previous file with comments | « build/android/pylib/utils/json_results_generator_unittest.py ('k') | build/android/pylib/utils/md5sum.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698