Skip to content
This repository has been archived by the owner on Apr 10, 2020. It is now read-only.
/ airbraker Public archive

Generic airbraker that integrated with airbrake service for Gin-backed web application

Notifications You must be signed in to change notification settings

theplant/airbraker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Airbraker

Build Status

Generic airbraker that integrated with airbrake service for Gin-backed web application

Quick Start

Airbrake configuration

Set up environment variables.

$ export AIRBRAKE_PROJECT_ID="your-project-id"
$ export AIRBRAKE_TOKEN="your-token"
$ export AIRBRAKE_ENV="your-app-env"

Set up Gin middleware

package main

import (
    "github.com/gin-gonic/gin"
    "github.com/theplant/airbraker"
)

func main() {
    r := gin.Default()

    // Set up recover middleware
    r.Use(airbraker.Recover())

    r.GET("/panic", func(c *gin.Context) {
        panic(errors.New("unexpected error"))
    })
    r.Run() // listen and server on 0.0.0.0:8080
}

After you start with go run main.go. You'll see:

Logging errors to Airbrake '<AIRBRAKE_ENV>' env on project <AIRBRAKE_PROJECT_ID>

Then it works. :)

About

Generic airbraker that integrated with airbrake service for Gin-backed web application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages