Merged in fix/logging-warmup-background (pull request #3232)
Fix/logging warmup background * fix: logging in background functions * fix logging * fix logging * fix logging Approved-by: Linus Flood
This commit is contained in:
committed by
Linus Flood
parent
26f3b5bdd0
commit
4174d43e16
@@ -1,21 +1,37 @@
|
||||
import { captureRequestError, init as sentryInit } from "@sentry/nextjs"
|
||||
/* eslint-disable no-console */
|
||||
import Sentry from "@sentry/nextjs"
|
||||
|
||||
export const denyUrls: (string | RegExp)[] = [
|
||||
// Ignore preview urls
|
||||
/\/.{2}\/preview\//,
|
||||
]
|
||||
|
||||
export const onRequestError = captureRequestError
|
||||
export const onRequestError = Sentry.captureRequestError
|
||||
|
||||
export async function configureSentry() {
|
||||
const sentryEnvironment = Netlify.env.get("SENTRY_ENVIRONMENT")
|
||||
const sentryEnvironment = Netlify.env.get("NEXT_PUBLIC_SENTRY_ENVIRONMENT")
|
||||
const sampleRate = Number(Netlify.env.get("SENTRY_SERVER_SAMPLERATE") ?? 0.01)
|
||||
sentryInit({
|
||||
Sentry.init({
|
||||
dsn: "https://fe39c070b4154e2f9cc35f0e5de0aedb@o4508102497206272.ingest.de.sentry.io/4508102500286544",
|
||||
environment: sentryEnvironment,
|
||||
enabled: sentryEnvironment !== "development",
|
||||
tracesSampleRate: sampleRate,
|
||||
denyUrls: denyUrls,
|
||||
enableLogs: true,
|
||||
beforeSendLog(log) {
|
||||
switch (log.level) {
|
||||
case "info":
|
||||
console.log(log.message, log)
|
||||
break
|
||||
case "warn":
|
||||
console.warn(log.message, log)
|
||||
break
|
||||
case "error":
|
||||
console.error(log.message, log)
|
||||
break
|
||||
}
|
||||
|
||||
return log
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user