---
tags: Sentry
---
# Sentry:
## :memo:
1. Introduciton
2. Set the Level
3. Example
### 1. Introduciton
sentry是Open Source 的App 監控平台,能夠應用在各式平台
https://docs.sentry.io/

優勢:
1. 最基本的方案是免費的
2. 詳細清楚的文件
3. 回報的訊息完整且清楚
### 2. Set the Level
The level - similar to logging levels - is generally added by default based on the integration. You can also override it within an event.
1) To set the level out of scope, you can call captureMessage() per event to set up diffent level warning ``:
```javascript=
Sentry.captureMessage("this is a debug message", "debug");
```
2) Available levels are "fatal", "error", "warning", "log", "info", and "debug".
To set the level within scope, you can call setLevel():
```javascript=
Sentry.configureScope(function (scope) {
scope.setLevel("warning");
});
```
[Reference](https://docs.sentry.io/platforms/react-native/usage/set-level/?original_referrer=https%3A%2F%2Fdocs.sentry.io%2Fplatforms%2Freact-native%2F)
## 3. Example:
```javascript=
const mockApiCall = async () => {
try {
const response = await sdk.getApiCall()
} catch (err) {
console.error(err)
Sentry.captureException(err)
}
}
```