ContextLines
添加当前页面 HTML 中内联 JavaScript 的源代码。
Import name: Sentry.contextLinesIntegration
此集成会将当前页面 HTML 中内联 JavaScript(例如 <script>
标签中的 JS)的源代码添加到捕获错误的堆栈跟踪中。 它 无法 收集由 HTML 引用的资源(例如 <script src="..." />
)中的源代码。
当您的 HTML 页面中有内联 JS 代码,而这些代码无法被 Sentry 的后端访问时(例如,由于页面受登录保护),ContextLines
集成非常有用。
Copied
import * as Sentry from "@sentry/browser";
Sentry.init({
dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
integrations: [Sentry.contextLinesIntegration()],
});
Type: number
围绕每个堆栈帧行号收集的行数。默认值为 7。