/treblle-go-gin

The official Treblle SDK for Go, tailored for the Gin framework. Seamlessly integrate Treblle into your Gin applications to effortlessly manage communication with your dashboard, transmit errors, and safeguard sensitive data.

Primary LanguageGoMIT LicenseMIT

treblle-go-gin

The offical Treblle SDK for Go using Gin

Installation

go get github.com/treblle/treblle-go-gin

Trebble uses Go Modules to manage dependencies.

Basic configuration

Configure Treblle at the start of your main() function:

import "github.com/treblle/treblle-go"

func main() {
	treblle.Configure(treblle.Configuration{
		APIKey:     "YOUR API KEY HERE",
		ProjectID:  "YOUR PROJECT ID HERE",
		KeysToMask: []string{"password", "card_number"}, // optional, mask fields you don't want sent to Treblle
		ServerURL:  "https://rocknrolla.treblle.com",    // optional, don't use default server URL
	}

    // rest of your program.
}

After that, just use the middleware with any of your Gin handlers:

r := gin.Default()
r.Use(treblle.GinMiddleware())