Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Also pin the ``pip`` upgrade to be ``<21.2``

* Work around pypa/pip#9450

See pypa/pip#10212

Co-authored-by: Megan Wilhite <[email protected]>
Co-authored-by: Gareth J. Greenaway <[email protected]>
  • Loading branch information
3 people authored and truzzon committed Aug 10, 2021
1 parent a76aa94 commit cd3e2e2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions salt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,6 @@ def __define_global_system_encoding_variable__():

# This is now garbage collectable
del __define_global_system_encoding_variable__

# Import Salt's logging machinery
import salt._logging.impl # isort:skip pylint: disable=unused-import
11 changes: 11 additions & 0 deletions salt/_logging/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,22 @@ def makeRecord(
# Override the python's logging logger class as soon as this module is imported
if logging.getLoggerClass() is not SaltLoggingClass:

# Import pip._internal which itself will install it's own custom logging handler
# we want to override that handler with ours
try:
import pip._internal.utils._log as pip_log_module # pylint: disable=no-name-in-module,import-error
except ImportError:
pip_log_module = None

logging.setLoggerClass(SaltLoggingClass)
logging.addLevelName(QUIET, "QUIET")
logging.addLevelName(PROFILE, "PROFILE")
logging.addLevelName(TRACE, "TRACE")
logging.addLevelName(GARBAGE, "GARBAGE")
if pip_log_module is not None:
# Let's make newer versions of pip work by patching SaltLoggingClass to
# add a verbose method which is what pip expects
SaltLoggingClass.verbose = SaltLoggingClass.debug

# ----- REMOVE ON REFACTORING COMPLETE -------------------------------------------------------------------------->
if not logging.root.handlers:
Expand Down

0 comments on commit cd3e2e2

Please sign in to comment.