项目作者: gin-contrib

项目描述 :
Middleware to integrate with rollbar error monitoring.
高级语言: Go
项目地址: git://github.com/gin-contrib/rollbar.git
创建时间: 2017-07-26T02:42:43Z
项目社区:https://github.com/gin-contrib/rollbar

开源协议:MIT License

下载


rollbar

Run Tests
codecov
Go Report Card
GoDoc
Join the chat at https://gitter.im/gin-gonic/gin

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

Usage

Download and install it:

  1. go get github.com/gin-contrib/rollbar

Import it in your code:

  1. import "github.com/gin-contrib/rollbar"

Example

  1. package main
  2. import (
  3. "log"
  4. "github.com/gin-contrib/rollbar"
  5. "github.com/gin-gonic/gin"
  6. roll "github.com/rollbar/rollbar-go"
  7. )
  8. func main() {
  9. roll.SetToken("MY_TOKEN")
  10. // roll.SetEnvironment("production") // defaults to "development"
  11. r := gin.Default()
  12. r.Use(rollbar.Recovery(true))
  13. if err := r.Run(":8080"); err != nil {
  14. log.Fatal(err)
  15. }
  16. }