Skip to content

Commit 13d6f3a

Browse files
committed
fix: save log stream subscription and print all from all loggers
1 parent da66f9f commit 13d6f3a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/supabase_flutter/lib/src/supabase.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:async';
2+
import 'dart:developer' as dev;
23

34
import 'package:async/async.dart';
45
import 'package:flutter/foundation.dart';
@@ -90,7 +91,7 @@ class Supabase {
9091
_instance._debugEnable = debug ?? kDebugMode;
9192

9293
if (_instance._debugEnable) {
93-
_log.onRecord.listen((record) {
94+
_instance._logSubscription = Logger('supabase').onRecord.listen((record) {
9495
if (record.level >= Level.INFO) {
9596
debugPrint(
9697
'${record.loggerName}: ${record.level.name}: ${record.message} ${record.error ?? ""}');
@@ -157,9 +158,12 @@ class Supabase {
157158
/// Wraps the `recoverSession()` call so that it can be terminated when `dispose()` is called
158159
late CancelableOperation _restoreSessionCancellableOperation;
159160

161+
StreamSubscription? _logSubscription;
162+
160163
/// Dispose the instance to free up resources.
161164
Future<void> dispose() async {
162165
await _restoreSessionCancellableOperation.cancel();
166+
_logSubscription?.cancel();
163167
client.dispose();
164168
_instance._supabaseAuth.dispose();
165169
_initialized = false;

packages/supabase_flutter/lib/src/supabase_auth.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ class SupabaseAuth with WidgetsBindingObserver {
288288
Future<void> _handleDeeplink(Uri uri) async {
289289
if (!_isAuthCallbackDeeplink(uri)) return;
290290

291-
_log.fine('handle deeplink uri: $uri');
291+
_log.finest('handle deeplink uri: $uri');
292292
_log.info('handle deeplink uri');
293293

294294
try {

0 commit comments

Comments
 (0)