summaryrefslogtreecommitdiff
path: root/setuptools/logging.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-12-26 14:15:15 -0500
committerJason R. Coombs <jaraco@jaraco.com>2021-12-28 16:24:39 -0500
commit382037c446f45ebc2e91fd5144eda4dfa90c0281 (patch)
tree56a2b8731c60d7edb78b352f3f298eb9fc9aff5d /setuptools/logging.py
parentb324f92d0a9583f07c137d29d4c68f2ae7fc4b68 (diff)
downloadpython-setuptools-git-382037c446f45ebc2e91fd5144eda4dfa90c0281.tar.gz
Add setuptools.log to supersede distutils.log. Ref #2973.
Diffstat (limited to 'setuptools/logging.py')
-rw-r--r--setuptools/logging.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/setuptools/logging.py b/setuptools/logging.py
new file mode 100644
index 00000000..0ac47059
--- /dev/null
+++ b/setuptools/logging.py
@@ -0,0 +1,22 @@
+import sys
+import logging
+
+
+def _not_warning(record):
+ return record.levelno < logging.WARNING
+
+
+def configure():
+ """
+ Configure logging to emit warning and above to stderr
+ and everything else to stdout. This behavior is provided
+ for compatibilty with distutils.log but may change in
+ the future.
+ """
+ err_handler = logging.StreamHandler()
+ err_handler.setLevel(logging.WARNING)
+ out_handler = logging.StreamHandler(sys.stdout)
+ out_handler.addFilter(_not_warning)
+ handlers = err_handler, out_handler
+ logging.basicConfig(
+ format="{message}", style='{', handlers=handlers, level=logging.DEBUG)