Skip to content

[firebase_crashlytics] Logging improvements #1359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/firebase_crashlytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.1.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+1

* Updated README instructions for contributing for consistency with other Flutterfire plugins.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -64,14 +69,10 @@ - (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);
CLSLog(@"%@", information);
}

// Report crash.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class Crashlytics {
});

// Print result.
print(result);
print('firebase_crashlytics: $result');
}
}
}
2 changes: 1 addition & 1 deletion packages/firebase_crashlytics/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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+1
version: 0.1.1+2
author: Flutter Team <[email protected]>
homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_crashlytics

Expand Down