Skip to content

Replace f-string logging with parameterized logging calls#152

Merged
CyberSecDef merged 2 commits into
mainfrom
copilot/fix-f-string-logging-issues
Apr 8, 2026
Merged

Replace f-string logging with parameterized logging calls#152
CyberSecDef merged 2 commits into
mainfrom
copilot/fix-f-string-logging-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

Three log statements used f-strings instead of parameterized logging, causing eager string formatting regardless of log level and breaking structured log grouping by template.

Changes

  • novelforge/routes/sessions.py: Replace f-strings in delete_session() for the info and error log calls
  • novelforge/__init__.py: Replace f-string in get_llm_log() for the warning log call
# Before
logger.info(f"Deleted session file {session_file}")
logger.error(f"Failed to delete session file: {e}")
logger.warning(f"LLM log file not found at {log_path}")

# After
logger.info("Deleted session file %s", session_file)
logger.error("Failed to delete session file: %s", e)
logger.warning("LLM log file not found at %s", log_path)

Copilot AI linked an issue Apr 8, 2026 that may be closed by this pull request
Copilot AI requested review from Copilot and removed request for Copilot April 8, 2026 20:30
Agent-Logs-Url: https://github.com/CyberSecDef/NovelForge/sessions/b5195deb-0b43-45f5-a65e-81ec27858ed0

Co-authored-by: CyberSecDef <17597068+CyberSecDef@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 8, 2026 20:31
Copilot AI changed the title [WIP] Fix f-string logging in multiple locations Replace f-string logging with parameterized logging calls Apr 8, 2026
Copilot AI requested a review from CyberSecDef April 8, 2026 20:32
@CyberSecDef CyberSecDef marked this pull request as ready for review April 8, 2026 20:41
Copilot AI review requested due to automatic review settings April 8, 2026 20:41
@CyberSecDef CyberSecDef merged commit cb909a2 into main Apr 8, 2026
9 checks passed
@CyberSecDef CyberSecDef deleted the copilot/fix-f-string-logging-issues branch April 8, 2026 20:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates logging statements to use parameterized logging instead of f-strings, avoiding eager string formatting when the relevant log level is disabled and keeping message templates consistent for downstream log processing.

Changes:

  • Replace f-string logger.info/logger.error calls in delete_session() with parameterized logging.
  • Replace f-string logger.warning call in get_llm_log() with parameterized logging.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
novelforge/routes/sessions.py Switches session deletion info/error logs to parameterized calls.
novelforge/__init__.py Switches missing-LLM-log warning to a parameterized call.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

f-String Logging in Multiple Locations

3 participants