-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Ability to log lifecycle changes #397
Comments
Can you elaborate this a bit more? I'm not sure how for what you would use this? |
It's used so I can have information about initialization and disposal of various classes in the console. I would like this global 'observer' where I can set that it logs someting like this when it initializes a class with GetIt: And when it disposes, I would log something like this: Does all this make sense? |
Adding logging for creation of instances inside get_it like from factories or lazy simpletons or any dependent singletons would be possible but because objects are not always actively disposed the question would be should it be logged if a dispose was called on a registered object? Or if the instance was removed from get_it. Even then we won't know if the object will get garbage collected because there could be another reference.
Whatndo you think makes here the most sense?
Am 24. Jan. 2025, 17:45 +0100 schrieb Josip K ***@***.***>:
… It's used so I can have information about initialization and disposal of various classes in the console.
It's something like a BlocObserver which you can check HERE.
I would like this global 'observer' where I can set that it logs someting like this when it initializes a class with GetIt:
✅ $className INITIALIZED ✅
And when it disposes, I would log something like this:
❌ $className DISPOSED ❌
Does all this make sense?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
I would love to have the ability to log when instances get created and when they get disposed. So yeah, adding the ability to use somekind of a global observer would be a cool feature for GetIt and WatchIt. But yeah, having the ability to add a global observer would help me a lot (and others, I'm sure). |
I would love to be able to track lifecycle changes of classes I instantiate using GetIt or WatchIt.
Something like an
observer
which can be passed toProviderScope
in Riverpod.So I can log when some class is instantated, disposed, etc.
The text was updated successfully, but these errors were encountered: