♻️ Refactor logger system

This commit is contained in:
2025-09-28 00:39:17 +08:00
parent 42bd7f97cb
commit fffca4a78c
28 changed files with 278 additions and 355 deletions

View File

@@ -1,11 +1,10 @@
import 'dart:developer';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart' hide ConnectionState;
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:gap/gap.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/pods/chat/call.dart';
import 'package:island/talker.dart';
import 'package:island/widgets/app_scaffold.dart';
import 'package:island/widgets/chat/call_button.dart';
import 'package:island/widgets/chat/call_overlay.dart';
@@ -26,14 +25,14 @@ class CallScreen extends HookConsumerWidget {
final callNotifier = ref.watch(callNotifierProvider.notifier);
useEffect(() {
log('[Call] Joining the call...');
talker.info('[Call] Joining the call...');
callNotifier.joinRoom(roomId).catchError((_) {
showConfirmAlert(
'Seems there already has a call connected, do you want override it?',
'Call already connected',
).then((value) {
if (value != true) return;
log('[Call] Joining the call... with overrides');
talker.info('[Call] Joining the call... with overrides');
callNotifier.disconnect();
callNotifier.dispose();
callNotifier.joinRoom(roomId);

View File

@@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -7,6 +5,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:dio/dio.dart';
import 'package:gap/gap.dart';
import 'package:island/pods/network.dart';
import 'package:island/talker.dart';
import 'package:island/widgets/alert.dart';
import 'package:island/models/poll.dart';
import 'package:island/widgets/app_scaffold.dart';
@@ -92,10 +91,10 @@ class PollEditor extends Notifier<PollEditorState> {
questions: poll.questions,
);
} on DioException catch (e) {
log('Failed to load poll $id: ${e.message}');
talker.error('Failed to load poll $id: ${e.message}');
// Keep state with id set; UI may handle error display.
} catch (e) {
log('Unexpected error loading poll $id: $e');
talker.error('Unexpected error loading poll $id: $e');
} finally {
if (context.mounted) hideLoadingModal(context);
}