Skip to content

Commit 7365ad2

Browse files
authored
Merge pull request #2849 from tipabu/logging-interpolation
Fix debug logging interpolation
2 parents 5b74c9a + ef616c7 commit 7365ad2

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/virtualenv/app_data/via_disk_folder.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,9 @@ def wheel_image(self, for_py_version, name):
108108

109109

110110
class JSONStoreDisk(ContentStore, ABC):
111-
def __init__(self, in_folder, key, msg, msg_args) -> None:
111+
def __init__(self, in_folder, key, msg_args) -> None:
112112
self.in_folder = in_folder
113113
self.key = key
114-
self.msg = msg
115114
self.msg_args = (*msg_args, self.file)
116115

117116
@property
@@ -130,7 +129,7 @@ def read(self):
130129
except Exception: # noqa: BLE001, S110
131130
pass
132131
else:
133-
LOGGER.debug("got %s from %s", self.msg, self.msg_args)
132+
LOGGER.debug("got %s %s from %s", *self.msg_args)
134133
return data
135134
if bad_format:
136135
with suppress(OSError): # reading and writing on the same file may cause race on multiple processes
@@ -139,7 +138,7 @@ def read(self):
139138

140139
def remove(self):
141140
self.file.unlink()
142-
LOGGER.debug("removed %s at %s", self.msg, self.msg_args)
141+
LOGGER.debug("removed %s %s at %s", *self.msg_args)
143142

144143
@contextmanager
145144
def locked(self):
@@ -150,22 +149,21 @@ def write(self, content):
150149
folder = self.file.parent
151150
folder.mkdir(parents=True, exist_ok=True)
152151
self.file.write_text(json.dumps(content, sort_keys=True, indent=2), encoding="utf-8")
153-
LOGGER.debug("wrote %s at %s", self.msg, self.msg_args)
152+
LOGGER.debug("wrote %s %s at %s", *self.msg_args)
154153

155154

156155
class PyInfoStoreDisk(JSONStoreDisk):
157156
def __init__(self, in_folder, path) -> None:
158157
key = sha256(str(path).encode("utf-8")).hexdigest()
159-
super().__init__(in_folder, key, "python info of %s", (path,))
158+
super().__init__(in_folder, key, ("python info of", path))
160159

161160

162161
class EmbedDistributionUpdateStoreDisk(JSONStoreDisk):
163162
def __init__(self, in_folder, distribution) -> None:
164163
super().__init__(
165164
in_folder,
166165
distribution,
167-
"embed update of distribution %s",
168-
(distribution,),
166+
("embed update of distribution", distribution),
169167
)
170168

171169

0 commit comments

Comments
 (0)