feat(clients): add Python, Go, and Java client libraries (BIT-14250)
Zero-dependency clients for errors.bitreport.pt following the same patterns as clients/node and clients/php: batch size 25, 5 s flush interval, 8 s HTTP timeout, fire-and-forget, env-var config. Each client ships with unit tests backed by an embedded HTTP server (no mocks), an example file, and a build manifest (pyproject.toml, go.mod, pom.xml). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
8bb49ce32b
commit
da57d2a444
12 files changed
+1653
No files matched your search
@@ -0,0 +1,46 @@
|
||||
//go:build ignore
|
||||
|
||||
// Basic usage example for the BitReport Go error reporter.
|
||||
//
|
||||
// Run with:
|
||||
//
|
||||
// ERROR_REPORTING_TOKEN=your_token go run basic_usage.go
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
errorreporter "pt.bitreport/errors-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
errorreporter.Init(errorreporter.Config{
|
||||
Token: os.Getenv("ERROR_REPORTING_TOKEN"),
|
||||
ProjectName: "My Go App",
|
||||
ProjectSlug: "my-go-app",
|
||||
})
|
||||
defer errorreporter.Flush()
|
||||
|
||||
// Report a plain message
|
||||
errorreporter.ReportMessage("Application started", "info", nil)
|
||||
|
||||
// Report a warning with extra context
|
||||
errorreporter.ReportMessage("Cache miss", "warning", map[string]interface{}{
|
||||
"cache_key": "user:42",
|
||||
})
|
||||
|
||||
// Report an error
|
||||
if err := riskyOperation(); err != nil {
|
||||
errorreporter.ReportError(err, map[string]interface{}{
|
||||
"operation": "riskyOperation",
|
||||
})
|
||||
}
|
||||
|
||||
fmt.Println("Events sent. Check your errors.bitreport.pt dashboard.")
|
||||
}
|
||||
|
||||
func riskyOperation() error {
|
||||
return errors.New("something went wrong")
|
||||
}
|
||||
Reference in new issue
Block a user