From cdc95031c26070ec9ccea3cc76751da2597a7712 Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Sun, 27 Oct 2019 15:10:12 -0700 Subject: [PATCH 1/6] Do not add verbose current code location to logs --- .../ios/Classes/FirebaseCrashlyticsPlugin.m | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/firebase_crashlytics/ios/Classes/FirebaseCrashlyticsPlugin.m b/packages/firebase_crashlytics/ios/Classes/FirebaseCrashlyticsPlugin.m index 01f233cbd347..ed11f016697e 100644 --- a/packages/firebase_crashlytics/ios/Classes/FirebaseCrashlyticsPlugin.m +++ b/packages/firebase_crashlytics/ios/Classes/FirebaseCrashlyticsPlugin.m @@ -42,7 +42,12 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result // Add logs. NSArray *logs = call.arguments[@"logs"]; for (NSString *log in logs) { - CLS_LOG(@"%@", log); + // Here and below, use CLSLog instead of CLS_LOG to try and avoid + // automatic inclusion of the current code location. It also ensures that + // the log is only written to Crashlytics and not also to the offline log + // as explained here: + // https://support.crashlytics.com/knowledgebase/articles/92519-how-do-i-use-logging + CLSLog(@"%@", log); } // Set keys. @@ -64,11 +69,7 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result } // Add additional information from the Flutter framework to the exception reported in - // Crashlytics. Using CLSLog instead of CLS_LOG to try to avoid the automatic inclusion of the - // line number. It also ensures that the log is only written to Crashlytics and not also to the - // offline log as explained here: - // https://support.crashlytics.com/knowledgebase/articles/92519-how-do-i-use-logging - // Although, that would only happen in debug mode, which this method call is never called in. + // Crashlytics. NSString *information = call.arguments[@"information"]; if ([information length] != 0) { CLSLog(information); From d4a18a472e7bcf96986cfb4c7b6730702bbd7b9e Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Sun, 27 Oct 2019 15:10:48 -0700 Subject: [PATCH 2/6] Avoid format string injections --- .../ios/Classes/FirebaseCrashlyticsPlugin.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/firebase_crashlytics/ios/Classes/FirebaseCrashlyticsPlugin.m b/packages/firebase_crashlytics/ios/Classes/FirebaseCrashlyticsPlugin.m index ed11f016697e..889b879745c7 100644 --- a/packages/firebase_crashlytics/ios/Classes/FirebaseCrashlyticsPlugin.m +++ b/packages/firebase_crashlytics/ios/Classes/FirebaseCrashlyticsPlugin.m @@ -72,7 +72,7 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result // Crashlytics. NSString *information = call.arguments[@"information"]; if ([information length] != 0) { - CLSLog(information); + CLSLog(@"%@", information); } // Report crash. From 5298a1ac46c520bad903a6c94f0dbe2c24e5667f Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Sun, 27 Oct 2019 15:12:24 -0700 Subject: [PATCH 3/6] Point out where the logging is coming from --- packages/firebase_crashlytics/lib/src/firebase_crashlytics.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/firebase_crashlytics/lib/src/firebase_crashlytics.dart b/packages/firebase_crashlytics/lib/src/firebase_crashlytics.dart index 355d187807f1..daad45cb7de2 100644 --- a/packages/firebase_crashlytics/lib/src/firebase_crashlytics.dart +++ b/packages/firebase_crashlytics/lib/src/firebase_crashlytics.dart @@ -264,7 +264,7 @@ class Crashlytics { }); // Print result. - print(result); + print('firebase_crashlytics: $result'); } } } From c98f9c09a993b27aa48e5627a07dc2917384ce53 Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Tue, 5 Nov 2019 06:38:00 +0100 Subject: [PATCH 4/6] Bump version (0.1.1 -> 0.1.2) and CHANGELOG --- packages/firebase_crashlytics/CHANGELOG.md | 7 +++++++ packages/firebase_crashlytics/pubspec.yaml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/firebase_crashlytics/CHANGELOG.md b/packages/firebase_crashlytics/CHANGELOG.md index b72c1bd639ee..c0f75e0a2f56 100644 --- a/packages/firebase_crashlytics/CHANGELOG.md +++ b/packages/firebase_crashlytics/CHANGELOG.md @@ -1,3 +1,10 @@ +## 0.1.2 + +* When reporting to Crashlytics on iOS, and printing supplied logs, do not + prepend each line with "FirebaseCrashlyticsPlugin.m line 44". +* Prepend `firebase_crashlytics: ` to the final answer from Crashlytics + plugin in the log to realize where it's coming from. + ## 0.1.1 * Log FlutterErrorDetails using Flutter's standard `FlutterError.dumpErrorToConsole`. diff --git a/packages/firebase_crashlytics/pubspec.yaml b/packages/firebase_crashlytics/pubspec.yaml index 5bd9bc8bbadd..07ed812277da 100644 --- a/packages/firebase_crashlytics/pubspec.yaml +++ b/packages/firebase_crashlytics/pubspec.yaml @@ -2,7 +2,7 @@ name: firebase_crashlytics description: Flutter plugin for Firebase Crashlytics. It reports uncaught errors to the Firebase console. -version: 0.1.1 +version: 0.1.2 author: Flutter Team homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_crashlytics From 65641ea0a1ec4b4f3371917defc5801d6402e26e Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Thu, 7 Nov 2019 14:30:37 -0800 Subject: [PATCH 5/6] Update CHANGELOG.md --- packages/firebase_crashlytics/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/firebase_crashlytics/CHANGELOG.md b/packages/firebase_crashlytics/CHANGELOG.md index c0f75e0a2f56..b4d14346e4ee 100644 --- a/packages/firebase_crashlytics/CHANGELOG.md +++ b/packages/firebase_crashlytics/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.1.2 +## 0.1.1+1 * When reporting to Crashlytics on iOS, and printing supplied logs, do not prepend each line with "FirebaseCrashlyticsPlugin.m line 44". From cf4fccd5bf226b89b5fab965c59c2cd9c5753120 Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Thu, 7 Nov 2019 14:30:47 -0800 Subject: [PATCH 6/6] Update pubspec.yaml --- packages/firebase_crashlytics/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/firebase_crashlytics/pubspec.yaml b/packages/firebase_crashlytics/pubspec.yaml index 07ed812277da..05894f9f3fd2 100644 --- a/packages/firebase_crashlytics/pubspec.yaml +++ b/packages/firebase_crashlytics/pubspec.yaml @@ -2,7 +2,7 @@ name: firebase_crashlytics description: Flutter plugin for Firebase Crashlytics. It reports uncaught errors to the Firebase console. -version: 0.1.2 +version: 0.1.1+1 author: Flutter Team homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_crashlytics