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.
10 from pylib
import constants
12 sys
.path
.append(os
.path
.join(
13 constants
.DIR_SOURCE_ROOT
, 'third_party', 'requests', 'src'))
14 sys
.path
.append(os
.path
.join(
15 constants
.DIR_SOURCE_ROOT
, 'third_party', 'appurify-python', 'src'))
16 handlers_before
= list(logging
.getLogger().handlers
)
21 handlers_after
= list(logging
.getLogger().handlers
)
22 new_handler
= list(set(handlers_after
) - set(handlers_before
))
24 logging
.info("Removing logging handler.")
25 logging
.getLogger().removeHandler(new_handler
.pop())
28 utils
= appurify
.utils
30 # This is not thread safe. If multiple threads are ever supported with appurify
31 # this may cause logging messages to go missing.
32 @contextlib.contextmanager
33 def SanitizeLogging(verbose_count
, level
):
35 logging
.disable(level
)
37 logging
.disable(logging
.NOTSET
)