From 2a35ea7c38968df5d22c899208721e136fd683b2 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Sun, 31 May 2020 02:42:58 +0200 Subject: [PATCH] BugReport: Send bug reports with new logs Earlier we used to call 'adb logcat' and get all the logs and send those. This didn't work on iOS and we wouldn't get all the logs even in android at times as the logcat buffer can be unreliable. Since now we log all the messages to a file, we can just send that file. The disadvtange is that we only get Dart level logs, and not iOS or Java or NDK or our C libraries logs. I should really dump libgit2 ASAP. --- lib/utils/logger.dart | 5 +++++ lib/widgets/app_drawer.dart | 8 +------- pubspec.lock | 7 ------- pubspec.yaml | 1 - 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/lib/utils/logger.dart b/lib/utils/logger.dart index 4c36e201..a6125cd5 100644 --- a/lib/utils/logger.dart +++ b/lib/utils/logger.dart @@ -130,6 +130,11 @@ class Log { } } } + + static String filePathForDate(DateTime dt) { + var date = dt.toString().substring(0, 10); + return p.join(logFolderPath, '$date.jsonl'); + } } class LogMessage { diff --git a/lib/widgets/app_drawer.dart b/lib/widgets/app_drawer.dart index 473f841c..fa6501b5 100644 --- a/lib/widgets/app_drawer.dart +++ b/lib/widgets/app_drawer.dart @@ -9,7 +9,6 @@ import 'package:launch_review/launch_review.dart'; import 'package:provider/provider.dart'; import 'package:share/share.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'package:fetch_app_logs/fetch_app_logs.dart'; import 'package:gitjournal/analytics.dart'; import 'package:gitjournal/state_container.dart'; @@ -165,12 +164,7 @@ class AppDrawer extends StatelessWidget { onTap: () async { var platform = Platform.operatingSystem; var versionText = await getVersionString(); - String appLogsFilePath; - try { - appLogsFilePath = await FetchAppLogs.dumpAppLogsToFile(); - } catch (e) { - print(e); - } + var appLogsFilePath = Log.filePathForDate(DateTime.now()); final Email email = Email( body: diff --git a/pubspec.lock b/pubspec.lock index e0aad687..8159f384 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -199,13 +199,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.1" - fetch_app_logs: - dependency: "direct main" - description: - name: fetch_app_logs - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.3" file: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 0d93910a..dca43c8f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,7 +34,6 @@ dependencies: dart_git: git: https://github.com/GitJournal/dart_git.git #path: /Users/vishesh/src/gitjournal/dart_git - fetch_app_logs: ^0.0.3 flutter_runtime_env: ^0.0.2 yaml_serializer: ^0.0.6 connectivity: ^0.4.6+1