diff --git a/lib/features/logs/view/logs_page.dart b/lib/features/logs/view/logs_page.dart index 13882d44..a003f860 100644 --- a/lib/features/logs/view/logs_page.dart +++ b/lib/features/logs/view/logs_page.dart @@ -18,7 +18,7 @@ import 'package:share_plus/share_plus.dart'; import 'package:tint/tint.dart'; import 'package:url_launcher/url_launcher.dart'; -class LogsPage extends HookConsumerWidget { +class LogsPage extends HookConsumerWidget with PresLogger { const LogsPage({super.key}); @override @@ -28,39 +28,26 @@ class LogsPage extends HookConsumerWidget { final notifier = ref.watch(logsNotifierProvider.notifier); final debug = ref.watch(debugModeProvider); + final filesEditor = ref.watch(filesEditorServiceProvider); final List popupButtons = debug || PlatformUtils.isDesktop ? [ PopupMenuItem( child: Text(t.logs.shareCoreLogs.sentenceCase), onTap: () async { - if (Platform.isWindows || Platform.isLinux) { - await launchUrl( - ref.read(filesEditorServiceProvider).logsDir.uri, - ); - } else { - final file = XFile( - ref.read(filesEditorServiceProvider).coreLogsPath, - mimeType: "text/plain", - ); - await Share.shareXFiles([file]); - } + await shareFileOrOpenDir( + filesEditor.coreLogsPath, + filesEditor.logsDir.uri, + ); }, ), PopupMenuItem( child: Text(t.logs.shareAppLogs.sentenceCase), onTap: () async { - if (Platform.isWindows || Platform.isLinux) { - await launchUrl( - ref.read(filesEditorServiceProvider).logsDir.uri, - ); - } else { - final file = XFile( - ref.read(filesEditorServiceProvider).appLogsPath, - mimeType: "text/plain", - ); - await Share.shareXFiles([file]); - } + await shareFileOrOpenDir( + filesEditor.appLogsPath, + filesEditor.logsDir.uri, + ); }, ), ] @@ -177,4 +164,17 @@ class LogsPage extends HookConsumerWidget { return const Scaffold(); } } + + Future shareFileOrOpenDir(String path, Uri dir) async { + try { + if (Platform.isWindows || Platform.isLinux) { + await launchUrl(dir); + } else { + final file = XFile(path, mimeType: "text/plain"); + await Share.shareXFiles([file]); + } + } catch (err, stackTrace) { + loggy.warning("error sharing log file", err, stackTrace); + } + } } diff --git a/lib/features/proxies/notifier/proxies_delay_notifier.dart b/lib/features/proxies/notifier/proxies_delay_notifier.dart index 4baa1ead..7bbbaad4 100644 --- a/lib/features/proxies/notifier/proxies_delay_notifier.dart +++ b/lib/features/proxies/notifier/proxies_delay_notifier.dart @@ -40,7 +40,7 @@ class ProxiesDelayNotifier extends _$ProxiesDelayNotifier with AppLogger { final testUrl = ref.read(connectionTestUrlProvider); final concurrent = ref.read(concurrentTestCountProvider); - loggy.debug( + loggy.info( 'testing delay for [${proxies.length}] proxies with [$testUrl], [$concurrent] at a time', ); diff --git a/lib/services/singbox/mobile_singbox_service.dart b/lib/services/singbox/mobile_singbox_service.dart index e4c3e4ee..b8b76bb0 100644 --- a/lib/services/singbox/mobile_singbox_service.dart +++ b/lib/services/singbox/mobile_singbox_service.dart @@ -71,7 +71,7 @@ class MobileSingboxService with InfraLogger implements SingboxService { Stream watchLogs(String path) { return _logsChannel.receiveBroadcastStream().map( (event) { - loggy.debug("received log: $event"); + // loggy.debug("received log: $event"); return event as String; }, );