Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 09cc7e1

Browse files
Merge pull request #973 from pboulch/master
Add Crashlytics log function
2 parents a06f2c6 + d8a55ae commit 09cc7e1

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

demo/app/main-view-model.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,9 +1632,11 @@ export class HelloWorldModel extends Observable {
16321632
public doLogMessageCrashlytics(): void {
16331633
if (isAndroid) {
16341634
// Send the desired exception
1635+
firebaseCrashlytics.log(1, "TAG", "Tag message");
16351636
firebaseCrashlytics.sendCrashLog(new java.lang.Exception("test Exception"));
16361637
} else if (isIOS) {
16371638
// Send the desired exception
1639+
firebaseCrashlytics.log(1, "TAG", "Tag message");
16381640
firebaseCrashlytics.sendCrashLog(new NSError({
16391641
domain: 'ShiploopHttpResponseErrorDomain',
16401642
code: 42,

src/crashlytics/crashlytics.android.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ export function sendCrashLog(exception: any /* java.lang.Exception */): void {
66
}
77
}
88

9+
export function log(priority: number, tag: string, msg: string): void {
10+
com.crashlytics.android.Crashlytics.log(priority, tag, msg);
11+
}
12+
913
export function setString(key: string, value: string): void {
1014
if (isCrashlyticsAvailable()) {
1115
com.crashlytics.android.Crashlytics.setString(key, value);

src/crashlytics/crashlytics.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55
export declare function sendCrashLog(exception: any): void;
66

7+
export declare function log(priority: number, tag: string, msg: string): void;
8+
79
export declare function setString(key: string, value: string): void;
810

911
export declare function setBool(key: string, value: boolean): void;

src/crashlytics/crashlytics.ios.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ export function sendCrashLog(exception: any /* NSError */): void {
44
}
55
}
66

7+
export function log(priority: number, tag: string, msg: string): void {
8+
Crashlytics.sharedInstance().logEvent(tag + " - " + msg);
9+
Crashlytics.logEvent("test-event");
10+
}
11+
712
export function setString(key: string, value: string): void {
813
if (isCrashlyticsAvailable()) {
914
Crashlytics.sharedInstance().setObjectValueForKey(value, key);

0 commit comments

Comments
 (0)