Files
uberbringer/uberbringer.go
William Gill 4a1dc609c7
Some checks failed
Create Release & Upload Assets / Upload Assets To Gitea w/ goreleaser (push) Failing after 9s
Create new type and remove un-used code
2025-01-12 19:37:53 -06:00

56 lines
1.6 KiB
Go

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("<bold><cyan>[" + config.Project + "]: Initializing Error Reporting...</cyan></bold>\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()
}