olusogin

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 4 Imported by: 0

README

olusogin

Oluso error monitoring middleware for Gin.

Installation

go get github.com/olusodotdev/oluso-go/gin

Usage

package main

import (
	"context"
	"log"
	"time"

	"github.com/gin-gonic/gin"
	"github.com/olusodotdev/oluso-go/gin"
	"github.com/olusodotdev/oluso-go"
)

func main() {
	client, err := oluso.New(oluso.Options{APIKey: "your-api-key"})
	if err != nil {
		log.Fatal(err)
	}
	defer func() {
		ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
		defer cancel()
		client.Flush(ctx)
	}()

	r := gin.New()
	r.Use(olusogin.Middleware(client))

	r.GET("/", func(c *gin.Context) {
		panic("something went wrong") // captured and reported automatically
	})

	r.Run(":8080")
}

Middleware scopes breadcrumbs to each request (accessible via c.Request.Context()), auto-reports panics and 5xx responses, and recovers from panics so one bad request doesn't take down the server.

See the root README for breadcrumbs, user context, manual reporting, and configuration — all identical across every Oluso Go adapter.

License

MIT

Documentation

Overview

Package olusogin provides Oluso error monitoring middleware for Gin.

Named olusogin rather than gin so it doesn't collide with (or force aliasing of) the github.com/gin-gonic/gin import in consuming code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(client *oluso.Client) gin.HandlerFunc

Middleware wraps Gin's request handling with Oluso error monitoring: it scopes breadcrumbs to the request, auto-reports panics and 5xx responses, and recovers from panics so one bad request doesn't take down the server.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL