sentry

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2021 License: MIT Imports: 10 Imported by: 0

README


DeepSource

sentry middleware

Supported Go versions & installation

⚙ gearbox requires version 1.14 or higher of Go (Download Go)

Just use go get to download and install gearbox

go get -u github.com/gogearbox/gearbox
go get u- github.com/gogearbox/sentry

Examples

package main

import (
	  "github.com/getsentry/sentry-go"
	  "github.com/gogearbox/gearbox"
    sentrymiddleware "github.com/gogearbox/sentry"
)

func main() {
	// Setup gearbox
	gb := gearbox.New()

	// Initialize sentry
	_ = sentry.Init(sentry.ClientOptions{
		Dsn:              PROJECT_DSN,
	})

	// Register the sentry middleware for all requests
	gb.Use(sentrymiddleware.New())

	// Define your handler
	gb.Post("/hello", func(ctx gearbox.Context) {
		panic("There is an issue")
	})

	// Start service
	gb.Start(":3000")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(options ...Options) func(ctx gearbox.Context)

New returns middleware handler

Types

type Options

type Options struct {
	// Repanic configures whether Sentry should repanic after recovery
	Repanic bool
	// WaitForDelivery configures whether you want to block the request before moving forward with the response
	WaitForDelivery bool
	// Timeout for the event delivery requests
	Timeout time.Duration
}

Options struct holds sentry middleware settings

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL