Skip to content

Instantly share code, notes, and snippets.

@tkc
Created March 26, 2020 07:30
Show Gist options
  • Save tkc/c4c886fb8abb2218ba3963b7cc349787 to your computer and use it in GitHub Desktop.
Save tkc/c4c886fb8abb2218ba3963b7cc349787 to your computer and use it in GitHub Desktop.
package main
import (
"errors"
"log"
"time"
"github.com/getsentry/sentry-go"
)
func main() {
err := sentry.Init(sentry.ClientOptions{
Dsn: "your auth key",
})
if err != nil {
log.Fatalf("sentry.Init: %s", err)
}
defer sentry.Flush(2 * time.Second)
sentry.WithScope(func(scope *sentry.Scope) {
scope.SetLevel(sentry.LevelFatal)
sentry.CaptureException(errors.New("example error"))
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment