@sentry-tools/browser
v0.0.2
Published
Sentry工具库,基于 `@sentry-tools/core` 和 `@sentry/browser`,提供浏览器环境的错误监控能力。
Downloads
92
Readme
@sentry-tools/browser
Sentry工具库,基于 @sentry-tools/core 和 @sentry/browser,提供浏览器环境的错误监控能力。
安装
npm install @sentry-tools/browser
# 或
yarn add @sentry-tools/browser
# 或
pnpm add @sentry-tools/browser基础配置
import SentryTools from '@sentry-tools/browser';
SentryTools.init({
browser: {
dsn: 'your-sentry-dsn',
},
});更多配置
import SentryTools from '@sentry-tools/browser';
SentryTools.init({
// Sentry浏览器配置
browser: {
dsn: 'your-sentry-dsn',
environment: 'production',
tracesSampleRate: 1.0,
},
// 传输管理器配置(微前端场景)
transport: {
transportOptions: [
{
dsn: 'dsn-1',
rule: (event) => event.tags?.category === 'api',
},
],
},
// 错误分类配置
category: {
defaultCategory: 'js',
categories: {
api: {
priority: -3,
rules: [{ path: 'errorName', match: 'ApiError', mode: 'inclusion' }],
},
},
},
// 白屏检测配置
blankScreen: {
enabled: true,
checkInterval: 3000,
},
});导出
@sentry-tools/core@sentry/browser
