Skip to content

Conversation

@crimsonknave
Copy link
Collaborator

In #83 I added logic to clean up the logger when the decorated function was done. I neglected to account for when the decorated function was provided another function's annotated logger. The logger would have been deleted from the logger dict early, but would have still existed and functioned. This shouldn't cause issues except in rare cases, but it's still good to behave as expected.

Copilot AI review requested due to automatic review settings October 22, 2025 17:11
@crimsonknave crimsonknave requested a review from a team as a code owner October 22, 2025 17:11
Copy link
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

This PR fixes a memory management issue where loggers were being prematurely removed from the logger dictionary when a decorated function received an annotated logger from another function. The fix ensures that loggers are only cleaned up when they were created by the decorator itself, not when they were provided from an external source.

Key Changes:

  • Added conditional cleanup logic to prevent premature logger removal when provided=True
  • Added test coverage to verify correct logger lifecycle management when passing loggers between decorated functions
  • Bumped version from 1.3.0 to 1.3.1

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
test/test_memory.py Adds new test verifying logger persistence when passed between decorated functions
annotated_logger/init.py Implements conditional logger cleanup based on whether logger was provided externally

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  annotated_logger
  __init__.py
Project Total  

This report was generated by python-coverage-comment-action

@crimsonknave crimsonknave merged commit 742a6aa into main Nov 7, 2025
25 of 26 checks passed
@crimsonknave crimsonknave deleted the logger-cleanup-provided-true branch November 7, 2025 16:08
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.

3 participants