inssentry

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

README

Sentry Package

This is a simple sentry wrapper.

Usage in Apps

package main

import (
	"errors"
	"github.com/useinsider/go-pkg/inssentry"
	"time"
)

func main() {
	sentrySettings := inssentry.Settings{
		SentryDsn:        "sentry_dsn",
		AttachStacktrace: true,
		FlushInterval:    2 * time.Second,
		IsProduction:     false,
	}
	err := inssentry.Init(sentrySettings)
	if err != nil {
		panic(err)
	}

	defer inssentry.Flush()

	inssentry.Error(errors.New("test_error"))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(err error)

Error sends the error to sentry.

func ErrorWithAdditionalData

func ErrorWithAdditionalData(err error, key string, value interface{})

ErrorWithAdditionalData sends the error to sentry with additional data.

func Fatal

func Fatal(err error)

Fatal sends the error to sentry and exit from the program.

func Flush

func Flush()

Flush sends the collected sentry messages to sentry.

func Init

func Init(settings Settings) error

Init caches the settings and opens the sentry client.

Types

type Settings

type Settings struct {
	SentryDsn        string
	AttachStacktrace bool
	FlushInterval    time.Duration
	IsProduction     bool
}

Settings is a struct for storing sentry options.

Jump to

Keyboard shortcuts

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