1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-09 01:45:03 +00:00
mon-entreprise/site/source/sentry.ts
Jérémy Rialland 545c02a972 Add capture console error in sentry
Update Sentry
2022-03-29 15:22:11 +02:00

32 lines
935 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import * as Sentry from '@sentry/react'
import { Integrations } from '@sentry/tracing'
import { getBranch, isProduction, isStaging } from './utils'
import { CaptureConsole } from '@sentry/integrations'
const branch = getBranch()
if (branch && isStaging()) {
// eslint-disable-next-line no-console
console.info(
` Vous êtes sur la branche : %c${branch}`,
'font-weight: bold; text-decoration: underline;'
)
}
const release =
branch && `${branch}-` + import.meta.env.VITE_GITHUB_SHA?.substring(0, 7)
if (isProduction()) {
Sentry.init({
dsn: 'https://92bbc21937b24136a2fe1b1d922b000f@o548798.ingest.sentry.io/5745615',
integrations: [
new Integrations.BrowserTracing(),
new CaptureConsole({ levels: ['error'] }),
],
release,
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 0.05,
})
}