LMCache / LMCache/LMCache

[good-first-issue] storage: convert f-string log calls in mooncakestore_connector.py to %-format

Open Beginner friendly
#4,506 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
11.9k
Forks
1.9k
Avg merge
4d 4h
Merged PRs (30d)
141

Description

**Label**

`good first issue`, `documentation`/`chore` — filing under [[Onboarding 2026] Good first issues](https://github.com/LMCache/LMCache/issues/3372) per the workflow in that thread.

**Describe the issue**

`lmcache/v1/storage_backend/connector/mooncakestore_connector.py` has 23 logger calls that build their message with an f-string, so the string is always interpolated even when the record is filtered out. Per @ApostaC's guidance in #3372, `%d`/`%s` style is preferred so the formatting is deferred until the record is actually emitted.

A few call sites in this file (the config-load and `setup()` paths) already use `%`-format, so this makes the file internally consistent.

Examples:

```python
logger.debug(f"Using batch_get_into for {len(keys)} keys (zero-copy mode)")
logger.error(f"batch_get_into threw exception: {str(exc)}")
```

become:

```python
logger.debug("Using batch_get_into for %d keys (zero-copy mode)", len(keys))
logger.error("batch_get_into threw exception: %s", exc)
```

Scope is one file, as suggested in #3372. No behavioral change.

---

**Side note that may be worth its own issue:** `[tool.ruff.lint]` in `pyproject.toml` sets no `select`, so ruff runs only its default rules (`E4`, `E7`, `E9`, `F`). Ruff's `G004` (`logging-f-string`) is exactly this check and is not enabled, which is why new f-string logging keeps landing. With `--select G004` it currently reports **396 violations under `lmcache/`**, and ruff has no autofix for it.

If maintainers are interested, enabling `G004` with a `per-file-ignores` list of the current offenders would stop new violations while the existing ones are burned down one good-first-issue at a time. Happy to file that separately — I didn't want to bundle a repo-wide lint config change into a single-file cleanup.

Contributor guide

Open the contributing guide

Research direction

Start with lmcache/v1/storage_backend/connector/mooncakestore_connector.py and review its 23 f-string logger calls alongside the existing %-format calls in the config-load and setup() paths. Convert only those logging messages while preserving their wording and arguments; done means the file uses deferred logging formatting consistently and has no remaining f-string logger calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.