From 2540fef72bc680a0ed92a94d73bf01cdd30044fa Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 26 Dec 2021 16:01:23 -0500 Subject: Replace bespoke logger with Python logging logger, restoring info/debug/warning levels to logged messages. Fixed missing f-string for 'wheelfile_path'. --- src/wheel/util.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/wheel/util.py') diff --git a/src/wheel/util.py b/src/wheel/util.py index f4d8149..af470b5 100644 --- a/src/wheel/util.py +++ b/src/wheel/util.py @@ -1,7 +1,9 @@ from __future__ import annotations import base64 -import sys +import logging + +log = logging.getLogger('wheel') def urlsafe_b64encode(data: bytes) -> bytes: @@ -13,14 +15,3 @@ def urlsafe_b64decode(data: bytes) -> bytes: """urlsafe_b64decode without padding""" pad = b"=" * (4 - (len(data) & 3)) return base64.urlsafe_b64decode(data + pad) - - -def log(msg: str, *, error: bool = False) -> None: - stream = sys.stderr if error else sys.stdout - try: - print(msg, file=stream, flush=True) - except UnicodeEncodeError: - # emulate backslashreplace error handler - encoding = stream.encoding - msg = msg.encode(encoding, "backslashreplace").decode(encoding) - print(msg, file=stream, flush=True) -- cgit v1.2.1