feat: sentry

This commit is contained in:
Torsten Dittmann committed 2022-11-14 16:06:25 +01:00
1 parent d5261290f3
commit 83b7ebcb44
5 files changed
+240 -8

No files matched your search

+1
View File
@@ -3,4 +3,5 @@
interface Window {
GOOGLE_ANALYTICS: string | false;
VERCEL_ANALYTICS_ID: string | false;
SENTRY_DSN: string | false;
}
+14
View File
@@ -11,10 +11,13 @@
import { Progress, Notifications } from '$lib/layout';
import { loading } from './store';
import Loading from './loading.svelte';
import * as Sentry from '@sentry/svelte';
import { BrowserTracing } from '@sentry/tracing';
if (browser) {
window.VERCEL_ANALYTICS_ID = import.meta.env.VERCEL_ANALYTICS_ID?.toString() ?? false;
window.GOOGLE_ANALYTICS = import.meta.env.VITE_GOOGLE_ANALYTICS?.toString() ?? false;
window.SENTRY_DSN = import.meta.env.VITE_SENTRY_DSN?.toString() ?? false;
}
onMount(async () => {
@@ -30,6 +33,17 @@
onTTFB(reportWebVitals);
}
/**
* Sentry Error Logging
*/
if (!dev && window.SENTRY_DSN) {
Sentry.init({
dsn: window.SENTRY_DSN,
integrations: [new BrowserTracing()],
tracesSampleRate: 1.0
});
}
/**
* Handle initial load.
*/