feat: logs

This commit is contained in:
Nevo David 2025-07-30 20:49:23 +07:00
parent 41c3bbf0bf
commit f9ad6be60a
3 changed files with 24 additions and 25 deletions

View File

@ -9,14 +9,10 @@ export const SentryComponent: FC<{ children: ReactNode }> = ({ children }) => {
useEffect(() => {
if (!dsn) {
return ;
return;
}
try {
initializeSentryClient(dsn);
} catch (error) {
console.error('[Sentry] Configuration error:', error);
}
initializeSentryClient(dsn);
}, [dsn]);
// Always render children - don't block the app

View File

@ -24,9 +24,10 @@ export const initializeSentry = (appName: string) => {
integrations: [
// Add our Profiling integration
nodeProfilingIntegration(),
Sentry.consoleLoggingIntegration({ levels: ['log', 'error', 'warn'] }),
],
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.3,
profilesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.1,
enableLogs: true,
});
} catch (err) {}
return true;

View File

@ -5,24 +5,26 @@ export const initializeSentryBasic = (dsn: string, extension: any) => {
return;
}
Sentry.init({
initialScope: {
tags: {
service: 'frontend',
component: 'nextjs',
replaysEnabled: 'true',
},
contexts: {
app: {
name: 'Postiz Frontend',
version: process.env.NEXT_PUBLIC_APP_VERSION || '0.0.0',
try {
Sentry.init({
initialScope: {
tags: {
service: 'frontend',
component: 'nextjs',
replaysEnabled: 'true',
},
contexts: {
app: {
name: 'Postiz Frontend',
version: process.env.NEXT_PUBLIC_APP_VERSION || '0.0.0',
},
},
},
},
dsn,
sendDefaultPii: true,
...extension,
debug: process.env.NODE_ENV === 'development',
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.3,
});
dsn,
sendDefaultPii: true,
...extension,
debug: process.env.NODE_ENV === 'development',
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.3,
});
} catch (err) {}
};