Skip to content

Commit 5039311

Browse files
Zsailerclaude
andcommitted
Fix logging messages to use proper lazy evaluation
- Replace f-strings in logging calls with % formatting for lazy evaluation - Prevents eager evaluation of expressions in logging statements - Follows Python logging best practices for performance and error handling - Maintains same informative error messages with proper logging patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 23b9bc0 commit 5039311

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

jupyterlab_git/git.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ def call_subprocess(
228228
except TimeoutError as e:
229229
# Handle our custom timeout errors
230230
code, output, error = -1, "", str(e)
231-
get_logger().warning(f"Git command timed out: {cmdline} - {str(e)}")
231+
get_logger().warning("Git command timed out: %s - %s", cmdline, str(e))
232232
except BaseException as e:
233233
code, output, error = -1, "", traceback.format_exc()
234-
get_logger().warning(f"Failed to execute git command: {cmdline}", exc_info=True)
234+
get_logger().warning("Failed to execute git command: %s", cmdline, exc_info=True)
235235
finally:
236236
execution_lock.release()
237237

@@ -272,9 +272,9 @@ def _cleanup_processes(self):
272272
except subprocess.TimeoutExpired:
273273
self._GIT_CREDENTIAL_CACHE_DAEMON_PROCESS.kill()
274274
self._GIT_CREDENTIAL_CACHE_DAEMON_PROCESS.wait()
275-
get_logger().debug(f"Git credential cache daemon process (PID: {self._GIT_CREDENTIAL_CACHE_DAEMON_PROCESS.pid}) cleaned up successfully")
275+
get_logger().debug("Git credential cache daemon process (PID: %s) cleaned up successfully", self._GIT_CREDENTIAL_CACHE_DAEMON_PROCESS.pid)
276276
except Exception as e:
277-
get_logger().warning(f"Failed to cleanup credential cache daemon: {e}")
277+
get_logger().warning("Failed to cleanup credential cache daemon: %s", e)
278278
finally:
279279
self._GIT_CREDENTIAL_CACHE_DAEMON_PROCESS = None
280280

0 commit comments

Comments
 (0)