2021-04-17 00:08:26 +00:00
|
|
|
"""Logging wrappers to reduce duplication elsewhere
|
|
|
|
|
|
|
|
Calling ``tox.reporter.something()`` and having to format a string with the prefix
|
|
|
|
gets really old fast, but more importantly it also makes the flow of the main code
|
|
|
|
more difficult to follow because of the added complexity.
|
|
|
|
"""
|
2024-08-16 18:27:46 +00:00
|
|
|
|
2023-01-10 02:34:35 +00:00
|
|
|
import logging
|
2021-04-17 00:08:26 +00:00
|
|
|
|
|
|
|
from tox_poetry_installer import constants
|
|
|
|
|
|
|
|
|
|
|
|
def error(message: str):
|
2023-01-10 02:34:35 +00:00
|
|
|
"""Wrapper around :func:`logging.error` that prefixes the reporter prefix onto the message"""
|
|
|
|
logging.error(f"{constants.REPORTER_PREFIX} {message}")
|
2021-04-17 00:08:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
def warning(message: str):
|
2023-01-10 02:34:35 +00:00
|
|
|
"""Wrapper around :func:`logging.warning`"""
|
|
|
|
logging.warning(f"{constants.REPORTER_PREFIX} {message}")
|
2021-04-17 00:08:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
def info(message: str):
|
2023-01-10 02:34:35 +00:00
|
|
|
"""Wrapper around :func:`logging.info`"""
|
|
|
|
logging.info(f"{constants.REPORTER_PREFIX} {message}")
|
2021-04-17 00:08:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
def debug(message: str):
|
2023-01-10 02:34:35 +00:00
|
|
|
"""Wrapper around :func:`logging.debug`"""
|
|
|
|
logging.debug(f"{constants.REPORTER_PREFIX} {message}")
|