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

Ability to log lifecycle changes #397

Open
jokilic opened this issue Jan 16, 2025 · 4 comments
Open

Ability to log lifecycle changes #397

jokilic opened this issue Jan 16, 2025 · 4 comments

Comments

@jokilic
Copy link

jokilic commented Jan 16, 2025

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 to ProviderScope in Riverpod.

So I can log when some class is instantated, disposed, etc.

@escamoteur
Copy link
Collaborator

Can you elaborate this a bit more? I'm not sure how for what you would use this?

@jokilic
Copy link
Author

jokilic commented Jan 24, 2025

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?

@escamoteur
Copy link
Collaborator

escamoteur commented Jan 25, 2025 via email

@jokilic
Copy link
Author

jokilic commented Jan 25, 2025

I would love to have the ability to log when instances get created and when they get disposed.
Whatever the reason for disposal is, logging would help me get a better understanding of the lifecycle and general behaviour of instances within my app.

So yeah, adding the ability to use somekind of a global observer would be a cool feature for GetIt and WatchIt.
Of course, if the developer doesn't add anything, it will behave without any logs or whatever.

But yeah, having the ability to add a global observer would help me a lot (and others, I'm sure).

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

No branches or pull requests

2 participants