supabase / supabase-flutter

Flutter integration for Supabase. This package makes it simple for developers to build secure and scalable products.
https://supabase.com/
MIT License
742 stars 183 forks source link

feat: Add logging #1042

Closed Vinzent03 closed 1 month ago

Vinzent03 commented 2 months ago

What kind of change does this PR introduce?

feature

What is the current behavior?

When debugging the auth broadcasting or the realtime/stream fixed I had to manually add many print statements, which was annoying. The js sdk already has some logging.

What is the new behavior?

Add logging via the logging package from dart.dev. This primarily only tracks the logs. When debug is true in the supabase_flutter Supabase instance, records with level INFO or higher are printed. The logger instances are laid in a hierarchy separated by dots, which allows all supabase loggers to be united in a supabase logger instance.

Vinzent03 commented 2 months ago

@dshukertjr For now, I've only added logging to the gotrue package. What do you think of this? If you consent, I would add this to the rest of the packages.

dshukertjr commented 2 months ago

This is awesome! I love it so much!

Vinzent03 commented 1 month ago

I've noticed that we should be careful with what data we log, especially sensitive data. So I've come up with the idea that records with level FINEST contain sensitive data like session data, or which postgrest urls are called. So that those records shouldn't be sent to sentry or similar without making such things clear in privacy notes. Let me know what you think of this approach and the documentation in the README of the supabase_flutter package, so I can add that section to the other packages as well.

Vinzent03 commented 1 month ago

I see now that there is no documentation in the README of the rest of the packages. So I would leave it for now only in the supabase_flutter package and you? or I? add it to the supabase website documentation.