Error tracking SDK for Go applications.
go get github.com/hymns/alertiqo-gopackage main
import (
"github.com/hymns/alertiqo-go"
)
func main() {
client := alertiqo.New(alertiqo.Config{
APIKey: "your-api-key",
Endpoint: "https://alertiqo.io",
Environment: "production",
Release: "1.0.0",
})
client.Init()
// Your application code...
}err := someFunction()
if err != nil {
client.CaptureException(err)
}client.CaptureMessage("User completed checkout", "info")client.AddBreadcrumb(
"User clicked button",
"user-action",
"info",
map[string]interface{}{"buttonId": "submit-btn"},
)client.SetUser(&alertiqo.User{
ID: "12345",
Email: "user@example.com",
Username: "johndoe",
})client.SetTag("page", "checkout")
client.SetTags(map[string]string{
"feature": "payments",
"version": "2.1.0",
})func handler() {
defer client.Recover()
// Code that might panic...
panic("something went wrong")
}package main
import (
"net/http"
"github.com/hymns/alertiqo-go"
)
func main() {
client := alertiqo.New(alertiqo.Config{
APIKey: "your-api-key",
Endpoint: "https://alertiqo.io",
})
client.Init()
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello World"))
})
// Wrap with middleware
handler := client.HTTPMiddleware(mux)
http.ListenAndServe(":8080", handler)
}Creates a new Alertiqo client.
Config Options:
APIKey(required): Your API keyEndpoint(required): Backend endpoint URLEnvironment: Environment name (default:GO_ENVor "production")Release: Release versionTags: Default tags for all errorsCaptureUnhandled: Auto-capture panics (default: false)BeforeSend: Callback to modify/filter errors before sending
Init(): Initialize error handlersCaptureException(err, additionalTags...): Capture an exceptionCaptureMessage(message, level): Capture a messageAddBreadcrumb(message, category, level, data): Add a breadcrumbSetUser(user): Set user contextSetTag(key, value): Set a single tagSetTags(tags): Set multiple tagsRecover(): Recover from panics and capture themHTTPMiddleware(handler): HTTP middleware for panic recovery
MIT