ginrollbar

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 7 Imported by: 0

README

GinRollbar

Run Tests codecov Go Report Card GoDoc

Middleware to integrate with rollbar error monitoring. It uses rollbar-go SDK that reports errors and logs messages.

Usage

Download and install it:

go get github.com/neiybor/ginrollbar

Import it in your code:

import "github.com/neiybor/ginrollbar"

Example

package main

import (
  "log"

  "github.com/gin-gonic/gin"
  "github.com/neiybor/ginrollbar"
  "github.com/rollbar/rollbar-go"
)

func main() {
  rollbar.SetToken("MY_TOKEN")
  // roll.SetEnvironment("production") // defaults to "development"

  r := gin.Default()
  r.Use(ginrollbar.Recovery(true, false, ""))

  if err := r.Run(":8080"); err != nil {
    log.Fatal(err)
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recovery

func Recovery(onlyCrashes, printStack bool, requestIdCtxKey string) gin.HandlerFunc

Recovery middleware for rollbar error monitoring

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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