Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Untracking variables created with lambda functions in the logger does not actually work #341

Open
tkevinbest opened this issue Mar 18, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@tkevinbest
Copy link
Member

Specifically, creating a lambda func in the untrack method will not work, though we show it in the docstring:

        Examples:
            # Single variable untracking
            >>> class MyClass:
            ...     def __init__(self):
            ...         self.value = 42
            >>> obj = MyClass()
            >>> LOGGER.track_variable(lambda: obj.value, "value")
            >>> LOGGER.update()
            >>> LOGGER.flush_buffer()
            >>> LOGGER.untrack_variable(lambda: obj.value)

            # Multiple variable untracking
            >>> class MyClass:
            ...     def __init__(self):
            ...         self.value1 = 42
            ...         self.value2 = 84
            >>> obj = MyClass()
            >>> LOGGER.track_variable(
            ...     [lambda: obj.value1, lambda: obj.value2],
            ...     ["value1", "value2"]
            ... )
            >>> LOGGER.update()
            >>> LOGGER.flush_buffer()
            >>> LOGGER.untrack_variable([lambda: obj.value1, lambda: obj.value2])

Instead of the lambda paradigm, I think we need to internally create these lambda functions so we can keep track of their ID. I'll implement if you agree.

Originally posted by @tkevinbest in #336

@tkevinbest tkevinbest moved this to Projects in opensourceleg Mar 18, 2025
@tkevinbest tkevinbest added the bug Something isn't working label Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Projects
Development

No branches or pull requests

1 participant