GlitchTip not SentryTip
This commit is contained in:
parent
cddef3b807
commit
f08b220ad5
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
16
main.go
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue