refactor: don't use f-string on logging statements
The strings are now be formatted if the logging level is enabled.
This commit is contained in:
parent
c414068c16
commit
861698987c
23 changed files with 94 additions and 84 deletions
|
@ -57,10 +57,10 @@ class LiquidsoapClient:
|
|||
while timeout > 0:
|
||||
try:
|
||||
version = self.version()
|
||||
logger.info(f"found version {version}")
|
||||
logger.info("found version %s", version)
|
||||
return version
|
||||
except (ConnectionError, TimeoutError) as exception:
|
||||
logger.warning(f"could not get version: {exception}")
|
||||
logger.warning("could not get version: %s", exception)
|
||||
timeout -= 1
|
||||
sleep(1)
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class LiquidsoapConnection:
|
|||
logger.debug("trying to acquire lock")
|
||||
# pylint: disable=consider-using-with
|
||||
self._lock.acquire()
|
||||
logger.debug(f"connecting to {self.address()}")
|
||||
logger.debug("connecting to %s", self.address())
|
||||
|
||||
if self._path is not None:
|
||||
self._sock = socket(AF_UNIX, SOCK_STREAM)
|
||||
|
@ -79,7 +79,7 @@ class LiquidsoapConnection:
|
|||
|
||||
def close(self):
|
||||
if self._sock is not None:
|
||||
logger.debug(f"closing connection to {self.address()}")
|
||||
logger.debug("closing connection to %s", self.address())
|
||||
|
||||
self.write("exit")
|
||||
# Reading for clean exit
|
||||
|
@ -97,7 +97,7 @@ class LiquidsoapConnection:
|
|||
raise InvalidConnection()
|
||||
|
||||
for message in messages:
|
||||
logger.debug(f"sending {message}")
|
||||
logger.debug("sending %s", message)
|
||||
buffer = message.encode(encoding="utf-8")
|
||||
buffer += b"\n"
|
||||
|
||||
|
@ -127,5 +127,5 @@ class LiquidsoapConnection:
|
|||
buffer = buffer.strip(b"\n")
|
||||
message = buffer.decode("utf-8")
|
||||
|
||||
logger.debug(f"received {message}")
|
||||
logger.debug("received %s", message)
|
||||
return message
|
||||
|
|
|
@ -58,5 +58,5 @@ def cli(log_level: str, log_filepath: Optional[Path], config_filepath: Optional[
|
|||
if log_level == "debug":
|
||||
exec_args.append("--debug")
|
||||
|
||||
logger.debug(f"liquidsoap {version} using script: {entrypoint_filepath}")
|
||||
logger.debug("liquidsoap %s using script: %s", version, entrypoint_filepath)
|
||||
os.execl(*exec_args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue