feature: send logs to Sentry for Redis-Api * feature: send logs to Sentry for Redis-Api Approved-by: Linus Flood
29 lines
723 B
TypeScript
29 lines
723 B
TypeScript
import "@sentry/tracing";
|
|
|
|
import * as Sentry from "@sentry/bun";
|
|
|
|
import { env } from "@/env";
|
|
|
|
const s = Sentry.init({
|
|
dsn: env.SENTRY_DSN,
|
|
enabled: env.SENTRY_ENABLED,
|
|
environment: env.SENTRY_ENVIRONMENT,
|
|
tracesSampleRate: env.SENTRY_TRACE_SAMPLE_RATE,
|
|
release: env.VERSION,
|
|
_experiments: {
|
|
enableLogs: true,
|
|
beforeSendLog(log) {
|
|
const ignoredLevels: (typeof log.level)[] = ["debug", "trace"];
|
|
if (ignoredLevels.includes(log.level)) {
|
|
return null;
|
|
}
|
|
|
|
return log;
|
|
},
|
|
},
|
|
});
|
|
|
|
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
export const sentry = s!;
|
|
export const SentryLogger = Sentry.logger;
|