,
}),
configurations: [
{
language: 'bash',
code: 'go get github.com/getsentry/sentry-go/negroni',
},
],
},
],
configure: params => [
{
type: StepType.CONFIGURE,
description: t(
"Import and initialize the Sentry SDK early in your application's setup:"
),
configurations: [
{
language: 'go',
code: getConfigureSnippet(params),
},
{
description: (
{tct(
'[code:sentrynegroni] accepts a struct of [code:Options] that allows you to configure how the handler will behave.',
{code: }
)}
{tct(
"[code:sentrynegroni] attaches an instance of [sentryHubLink:*sentry.Hub] to the request's context, which makes it available throughout the rest of the request's lifetime. You can access it by using the [code:sentry.GetHubFromContext()] method on the request itself in any of your proceeding middleware and routes. And it should be used instead of the global [code:sentry.CaptureMessage], [code:sentry.CaptureException], or any other calls, as it keeps the separation of data between the requests.",
{
code: ,
sentryHubLink: (
}
)}
,
})}
),
language: 'go',
code: getBeforeSendSnippet(params),
},
],
},
{
title: t("Using Negroni's 'panicHandlerFuncCode' Option"),
description: (
{tct(
"Negroni provides an option called [code:PanicHandlerFunc], which lets you 'plug-in' to its default [code:Recovery] middleware.",
{
code: ,
}
)}
{tct(
"[sentrynegroniCode:sentrynegroni] exports a very barebones implementation, which utilizes it, so if you don't need anything else than just reporting panics to Sentry, you can use it instead, as it's just one line of code!",
{
sentrynegroniCode: ,
}
)}
{tct(
'You can still use [beforeSendCode:BeforeSend] and event processors to modify data before delivering it to Sentry, using this method as well.',
{
beforeSendCode: ,
}
)}