package main import ( "log" "net/http" "time" "github.com/getsentry/sentry-go" "github.com/liamg/tml" "uberbringer/cmd" "uberbringer/config" ) func main() { //// ***** Start Sentry ***** //// tml.Printf("[" + config.Project + "]: Initializing Error Reporting...\n") sentrySyncTransport := sentry.NewHTTPSyncTransport() sentrySyncTransport.Timeout = time.Second * 3 err := sentry.Init(sentry.ClientOptions{ // Either set your DSN here or set the SENTRY_DSN environment variable. Dsn: config.SentryDSN, // Either set environment and release here or set the SENTRY_ENVIRONMENT // and SENTRY_RELEASE environment variables. Environment: "Production", Release: config.Project + "@" + config.Version, // Enable printing of SDK debug messages. Debug: true, // Useful when getting started or trying to figure something out. AttachStacktrace: true, Transport: sentrySyncTransport, BeforeSend: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event { if hint.Context != nil { if req, ok := hint.Context.Value(sentry.RequestContextKey).(*http.Request); ok { // You have access to the original Request log.Println(req) } } log.Println(event) return event }, }) if err != nil { log.Fatalf("["+config.Project+"]: Sentry initialization failed: %v\n", err) } // Flush buffered events before the program terminates. // Set the timeout to the maximum duration the program can afford to wait. defer sentry.Flush(2 * time.Second) //// ***** End Sentry ***** //// cmd.Execute() }