27 lines
708 B
TypeScript
27 lines
708 B
TypeScript
import * as Sentry from "@sentry/nextjs";
|
|
|
|
export interface SentryConfig {
|
|
dsn?: string;
|
|
enabled?: boolean;
|
|
tracesSampleRate?: number;
|
|
tunnel?: string;
|
|
replaysOnErrorSampleRate?: number;
|
|
replaysSessionSampleRate?: number;
|
|
}
|
|
|
|
/**
|
|
* Standardized Sentry initialization for Mintel projects.
|
|
*/
|
|
export function initSentry(config: SentryConfig) {
|
|
Sentry.init({
|
|
dsn: config.dsn,
|
|
enabled: config.enabled ?? Boolean(config.dsn || config.tunnel),
|
|
tracesSampleRate: config.tracesSampleRate ?? 0,
|
|
tunnel: config.tunnel,
|
|
replaysOnErrorSampleRate: config.replaysOnErrorSampleRate ?? 1.0,
|
|
replaysSessionSampleRate: config.replaysSessionSampleRate ?? 0.1,
|
|
});
|
|
}
|
|
|
|
export { Sentry };
|