Skip to content

Commit a9a8953

Browse files
authored
Update crash.md
1 parent 95979cb commit a9a8953

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

v3.0.*/crash/reference/crash.md

+39-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ The following methods are accessed via the Crash instance `firebase.crash()`.
1313

1414
Enables or disables crash reporting.
1515

16+
[collapse Example]
17+
```js
18+
firebase.crash().setCrashCollectionEnabled(false);
19+
```
20+
[/collapse]
21+
1622
| Parameter | |
1723
| --------- | ------- |
1824
| enabled | **boolean** <br />Whether crash reporting is enabled or disabled |
@@ -22,21 +28,42 @@ Enables or disables crash reporting.
2228

2329
Returns whether crash reporting is currently enabled or disabled.
2430

31+
[collapse Example]
32+
```js
33+
firebase.crash().isCrashCollectionEnabled();
34+
.then((isEnabled) => {
35+
console.log('Crash reporting is enabled: ', isEnabled);
36+
});
37+
```
38+
[/collapse]
39+
2540
### log
2641
[method]log(message) returns void;[/method]
2742

2843
Logs a message that will be sent with a [ref crash#report].
2944

45+
[collapse Example]
46+
```js
47+
firebase.crash().log('Something went really wrong!');
48+
```
49+
[/collapse]
50+
3051
| Parameter | |
3152
| --------- | ------- |
3253
| message | **string** |
3354

3455
### logcat
35-
[method]isCrashCollectionEnabled(level, tag, message) returns void;[/method]
56+
[method]logcat(level, tag, message) returns void;[/method]
3657

3758
[android] Logs a message that will appear in a subsequent crash report as well as in [logcat](https://developer.android.com/studio/command-line/logcat.html).
3859
[ios] Logs the message in the subsequest crash report only (same as log).
3960

61+
[collapse Example]
62+
```js
63+
firebase.crash().logcat(1, 'CRASH', 'Something went really wrong!');
64+
```
65+
[/collapse]
66+
4067
| Parameter | |
4168
| --------- | --- |
4269
| level | **number** |
@@ -50,6 +77,17 @@ Sends the crash report, along with any previous [ref crash#log] or [ref crash#lo
5077

5178
> Reports are not realtime. They can take a number of hours to appear in the Firebase console.
5279
80+
[collapse Example]
81+
```js
82+
try {
83+
loadSomeService();
84+
} catch(e) {
85+
firebase.crash().log('Service failed to load');
86+
firebase.crash().report(e, 10);
87+
}
88+
```
89+
[/collapse]
90+
5391
| Parameter | |
5492
| --------- | --- |
5593
| error | [**Error**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) <br /> A JavaScript Error. |

0 commit comments

Comments
 (0)