my-notes-viewer/src/sentry.ts
2021-03-22 15:59:05 +01:00

25 lines
732 B
TypeScript

import * as Sentry from "@sentry/browser"
import { Integrations } from "@sentry/tracing"
export const init = (dsn, tracingOrigins, environment) => {
if (typeof window !== "undefined") {
Sentry.init({
dsn: dsn,
integrations: [
new Integrations.BrowserTracing({
tracingOrigins: tracingOrigins,
traceFetch: false,
traceXHR: false,
}),
],
environment: environment,
tracesSampleRate: 1.0,
debug: false,
})
console.log("Sentry initialized")
}
}
export const currentTransaction = () =>
Sentry.getCurrentHub().getScope().getTransaction()