annotated-logger 1.2.4__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: annotated-logger
3
- Version: 1.2.4
3
+ Version: 1.3.0
4
4
  Summary: A decorator that logs the start and end of a function as well as providing an optional logger with annotations
5
5
  Project-URL: Homepage, https://github.com/github/annotated-logger
6
6
  Author-email: Vuln Mgmt Eng <security+vulnmgmteng@github.com>
@@ -33,7 +33,7 @@ if TYPE_CHECKING: # pragma: no cover
33
33
  # https://test.pypi.org/project/annotated-logger/
34
34
  # The dev versions in testpypi can then be pulled in to whatever project needed
35
35
  # the new feature.
36
- VERSION = "1.2.4" # pragma: no mutate
36
+ VERSION = "1.3.0" # pragma: no mutate
37
37
 
38
38
  T = TypeVar("T")
39
39
  P = ParamSpec("P")
@@ -653,7 +653,7 @@ class AnnotatedLogger:
653
653
  # Between the overloads and the two inner method definitions,
654
654
  # there's not much I can do to reduce the complexity more.
655
655
  # So, ignoring the complexity metric
656
- def annotate_logs( # noqa: C901
656
+ def annotate_logs( # noqa: C901 PLR0915
657
657
  self,
658
658
  logger_name: str | None = None,
659
659
  *,
@@ -787,6 +787,10 @@ class AnnotatedLogger:
787
787
  if post_call and not post_call_attempted:
788
788
  _attempt_post_call(post_call, logger, *new_args, **new_kwargs) # pyright: ignore[reportCallIssue]
789
789
  raise
790
+ finally:
791
+ # Remove the logger now that we are done with it,
792
+ # otherwise they build up and eat memory
793
+ logging.root.manager.loggerDict.pop(logger.logger.name, None)
790
794
  return result
791
795
 
792
796
  return wrap_function