Skip to content

Commit 2d66df1

Browse files
authored
style: convert remaining logger %-style calls to f-strings (#23)
Last 3 logger calls still using printf-style formatting; all other log messages and inline string formatting already use f-strings. Template constants in constants.py keep .format() since they are an i18n boundary.
1 parent 2fc9b5c commit 2d66df1

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/bot/plugins/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ async def wrapper(
147147
effective_map: dict[int, dict[str, bool]] = context.bot_data.get("plugin_effective_map", {})
148148

149149
if not is_plugin_enabled_for_group(effective_map, group_id, plugin_name):
150-
logger.debug("Plugin '%s' disabled for group %d, skipping", plugin_name, group_id)
150+
logger.debug(f"Plugin '{plugin_name}' disabled for group {group_id}, skipping")
151151
return
152152

153153
await callback(update, context, *args, **kwargs)

src/bot/plugins/manager.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ def register_all(
150150
handlers = registrar(application)
151151
result[name] = handlers
152152
noun = "job(s)" if name.endswith("_job") else "handler(s)"
153-
logger.info("Registered plugin: %s (group=%d, %d %s)", name, defs_by_name[name]["handler_group"], len(handlers), noun) # type: ignore[arg-type]
153+
group = defs_by_name[name]["handler_group"]
154+
logger.info(
155+
f"Registered plugin: {name} (group={group}, {len(handlers)} {noun})"
156+
)
154157

155158
# Store metadata for later gating
156159
metadata: dict[str, dict] = {}
@@ -188,5 +191,5 @@ def compute_effective_map(
188191
plugins_default = getattr(settings, "plugins_default", {})
189192
effective_map = compute_effective_plugin_map(plugins_default, registry)
190193
application.bot_data["plugin_effective_map"] = effective_map # type: ignore[index]
191-
logger.info("Computed effective plugin map for %d group(s)", len(effective_map))
194+
logger.info(f"Computed effective plugin map for {len(effective_map)} group(s)")
192195
return effective_map

0 commit comments

Comments
 (0)