Skip to content

Commit 44a693a

Browse files
committed
docs: add documentation to supabase_flutter readme
1 parent 8ce8aa7 commit 44a693a

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

packages/supabase_flutter/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,36 @@ Supabase.initialize(
596596
);
597597
```
598598

599+
## Logging
600+
601+
All Supabase packages use the [logging](https://pub.dev/packages/logging) package to log information. Each sub-package has its own logger instance. You can listen to logs and set custom log levels for each logger.
602+
603+
In debug mode, or depending on the value for `debug` from `Supabase.initialize()`, records with `Level.INFO` and above are printed to the console.
604+
605+
Records containing sensitive data like access tokens and which requests are made are logged with `Level.FINEST`, so you can handle them accordingly.
606+
607+
### Listen to all Supabase logs
608+
609+
```dart
610+
import 'package:logging/logging.dart';
611+
612+
final supabaseLogger = Logger('supabase');
613+
supabaseLogger.level = Level.ALL; // custom log level filtering, default is Level.INFO
614+
supabaseLogger.onRecord.listen((record) {
615+
print('${record.level.name}: ${record.time}: ${record.message}');
616+
});
617+
```
618+
619+
### Sub-package loggers
620+
621+
- `supabase_flutter`: `Logger('supabase.supabase_flutter')`
622+
- `supabase`: `Logger('supabase.supabase')`
623+
- `postgrest`: `Logger('supabase.postgrest')`
624+
- `gotrue`: `Logger('supabase.gotrue')`
625+
- `realtime_client`: `Logger('supabase.realtime')`
626+
- `storage_client`: `Logger('supabase.storage')`
627+
- `functions_client`: `Logger('supabase.functions')`
628+
599629
---
600630

601631
## Migrating Guide

packages/supabase_flutter/lib/src/supabase.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Supabase {
7070
/// PKCE flow uses shared preferences for storing the code verifier by default.
7171
/// Pass a custom storage to [pkceAsyncStorage] to override the behavior.
7272
///
73-
/// If [debug] is set to `true`, debug logs will be printed in debug console.
73+
/// If [debug] is set to `true`, debug logs will be printed in debug console. Default is `kDebugMode`.
7474
static Future<Supabase> initialize({
7575
required String url,
7676
required String anonKey,

0 commit comments

Comments
 (0)