diff options
Diffstat (limited to 'src/wheel/util.py')
-rw-r--r-- | src/wheel/util.py | 15 |
1 files changed, 3 insertions, 12 deletions
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) |