1
1
Fork 0

GlitchTip not SentryTip

This commit is contained in:
Colin 2024-06-15 23:04:11 -04:00
parent cddef3b807
commit f08b220ad5
9 changed files with 8 additions and 8 deletions

BIN
.DS_Store vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

16
main.go
View File

@ -60,11 +60,11 @@ func isInputFromPipe() bool {
return fileInfo.Mode()&os.ModeCharDevice == 0
}
// Function to handle sending data to Sentry
// Function to handle sending data to Glitchtip
func sendToSentry(logMessage string) {
dsn := os.Getenv("SENTRY_DSN")
dsn := os.Getenv("GLITCHTIP_DSN")
if dsn == "" {
fmt.Fprintf(os.Stderr, "Error: SENTRY_DSN environment variable is not set.\n")
fmt.Fprintf(os.Stderr, "Error: GLITCHTIP_DSN environment variable is not set.\n")
os.Exit(1)
}
@ -72,23 +72,23 @@ func sendToSentry(logMessage string) {
Dsn: dsn,
})
if err != nil {
fmt.Fprintf(os.Stderr, "Error initializing Sentry: %s\n", err)
fmt.Fprintf(os.Stderr, "Error initializing GlitchTip: %s\n", err)
os.Exit(1)
}
defer func() {
success := sentry.Flush(5 * time.Second)
if !success {
fmt.Fprintf(os.Stderr, "Failed to flush Sentry buffer within the expected time.\n")
fmt.Fprintf(os.Stderr, "Failed to flush GlitchTip buffer within the expected time.\n")
} else {
fmt.Println("Sentry buffer flushed successfully.")
fmt.Println("GlitchTip buffer flushed successfully.")
}
}()
eventID := sentry.CaptureMessage(logMessage)
if eventID != nil {
fmt.Printf("Sent message to Sentry with event ID: %s\n", *eventID)
fmt.Printf("Sent message to GlitchTip with event ID: %s\n", *eventID)
} else {
fmt.Fprintf(os.Stderr, "Failed to send message to Sentry.\n")
fmt.Fprintf(os.Stderr, "Failed to send message to GlitchTip.\n")
}
}