Skip to content

Build the log messages of string lookups only when logging is on - #30

Merged
hemju merged 1 commit into
mainfrom
lazy-lookup-debug-logging
Sep 26, 2026
Merged

hemju merged 1 commit into
mainfrom
lazy-lookup-debug-logging

Conversation

@hemju

@hemju hemju commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

At LingoHubLogLevel.NONE (the default in release builds), string lookups still built their debug messages, because the level was only checked inside the logger. That meant about six throwaway strings per getString(), plus a getResourceTypeName() call that only fed one of them. The lookup path runs during view inflation and Compose recomposition, and with LingoHub.wrap() (#29) also for the application context and Services.

Verified: ./gradlew build passes (98 unit tests including the new LingoHubLoggerTest, lint), and javap shows every log message in ResourcesUtil and Repository built only behind the level check. The branch merges cleanly with #29, and the merged tree builds too.

ResourcesUtil and Repository passed finished strings to the logger, which
only then checked the level. At LingoHubLogLevel.NONE, the default in
release builds, every getString() still built about six messages that
were thrown away, and looked up the resource type name for one of them.
These lookups run for every getString() and stringResource() in
Activities, often during view inflation and Compose recomposition, and
with LingoHub.wrap() (org #2350) for the application context and
Services as well.

LingoHubLogger.debug {} and warn {} check the level first and build the
message only at FULL. The messages at FULL stay the same.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T15:51:37.455859Z 438c980 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@hemju
hemju merged commit da04483 into main Sep 26, 2026
2 checks passed
@hemju
hemju deleted the lazy-lookup-debug-logging branch September 26, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant