Integrates error logging

This commit is contained in:
Alicia Sykes
2023-07-23 23:54:56 +01:00
parent ab2ec0e823
commit 3f1b4bea3a
3 changed files with 81 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
import { Route, Routes } from 'react-router-dom';
import Styled from 'styled-components';
import * as Sentry from '@sentry/react';
import Home from 'pages/Home';
import Results from 'pages/Results';
import About from 'pages/About';
@@ -14,6 +16,18 @@ const Container = Styled.main`
margin: 0;
`;
Sentry.init({
dsn: 'https://30eb6135d37643fb95c7da4e77a46142@glitch.as93.net/1',
beforeSend(event) { // Check if error logging is disabled
const ignoredHosts = ['localhost', '127.0.0.1'];
const disableErrors = process.env.REACT_APP_DISABLE_ERROR_LOGGING;
if (disableErrors || ignoredHosts.includes(window.location.hostname)) {
return null;
}
return event;
}
});
function App() {
return (
<Container>