lablup / lablup/backend.ai

Fix BraceStyleAdapter f-string log calls across the codebase

Open
#11,687 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

## Background

BraceStyleAdapter (the project-wide logger adapter) always re-runs str.format() on the resolved message via BraceMessage.__str__. When a log call is built with an f-string, Python evaluates the f-string eagerly first, and the resulting string is then handed to BraceStyleAdapter which calls .format() on it with the supplied args. Any literal { / } left in the resolved message (very common in exception reprs containing dicts, sets, or formatted args) will raise KeyError, IndexError, or ValueError inside the logger, suppressing the original message and surfacing only a logging error.

## Scope

Codebase-wide sweep of all log.(f"...") call sites where the logger variable is bound to a BraceStyleAdapter instance, excluding CLI and tests. Mechanical conversion to brace-style format with separate positional arguments so formatting happens lazily and runtime brace characters cannot break the logger.

## Child issues

- BA-6099 — original report, dispatcher.py single site (milestone 25.15)
- BA-6105 — 25.15-LTS-scope sweep, 33 files / 153 sites (milestone 25.15)
- BA-6104 — 26.4-scope sweep, 15 files / 39 sites (milestone 26.4)
- BA-6103 — main-only-scope sweep, 2 files / 3 sites (milestone 26.5)

JIRA Issue: BA-6106

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.