Sentry.init({
// Client's DSN.dsn: 'https://363a337c11a64611be4845ad6e24f3ac@sentry.io/297378',
// An array of strings or regexps that'll be used to ignore specific errors based on their type/messageignoreErrors: [/PickleRick_\d\d/, 'RangeError'],
// An array of strings or regexps that'll be used to ignore specific errors based on their origin urldenyUrls: ['external-lib.js'],
// An array of strings or regexps that'll be used to allow specific errors based on their origin urlallowUrls: ['http://localhost:5000', 'https://browser.sentry-cdn'],
// Debug mode with valuable initialization/lifecycle informations.debug: true,
// Whether SDK should be enabled or not.enabled: true,
// Custom integrations callbackintegrations(integrations) {
return [newHappyIntegration(), ...integrations];
},
// A release identifier.release: '1537345109360',
// An environment identifier.environment: 'staging',
// Custom event transport that will be used to send things to Sentrytransport: HappyTransport,
// Method called for every captured eventasyncbeforeSend(event, hint) {
// Because beforeSend and beforeBreadcrumb are async, user can fetch some data// return a promise, or whatever he wants// Our CustomError defined in errors.js has `someMethodAttachedToOurCustomError`// which can mimick something like a network request to grab more detailed error info or something.// hint is original exception that was triggered, so we check for our CustomError nameif (hint.originalException.name === 'CustomError') {
const serverData = await hint.originalException.someMethodAttachedToOurCustomError();
event.extra = {
...event.extra,
serverData,
};
}
console.log(event);
return event;
},
// Method called for every captured breadcrumbbeforeBreadcrumb(breadcrumb, hint) {
// We ignore our own logger and rest of the buttons just for presentation purposesif (breadcrumb.message.startsWith('Sentry Logger')) returnnull;
if (breadcrumb.category !== 'ui.click' || hint.event.target.id !== 'breadcrumb-hint') returnnull;
// If we have a `ui.click` type of breadcrumb, eg. clicking on a button we defined in index.html// We will extract a `data-label` attribute from it and use it as a part of the messageif (breadcrumb.category === 'ui.click') {
const label = hint.event.target.dataset.label;
if (label) {
breadcrumb.message = `User clicked on a button with label "${label}"`;
}
}
console.log(breadcrumb);
return breadcrumb;
},
});
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· AI Agent开发,如何调用三方的API Function,是通过提示词来发起调用的吗