Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gin-contrib/rollbar
Middleware to integrate with rollbar error monitoring.
https://github.com/gin-contrib/rollbar
gin gin-contrib middleware rollbar
Last synced: 4 months ago
JSON representation
Middleware to integrate with rollbar error monitoring.
- Host: GitHub
- URL: https://github.com/gin-contrib/rollbar
- Owner: gin-contrib
- License: mit
- Created: 2017-07-26T02:42:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-04T12:23:24.000Z (6 months ago)
- Last Synced: 2024-10-02T05:22:48.599Z (5 months ago)
- Topics: gin, gin-contrib, middleware, rollbar
- Language: Go
- Size: 85 KB
- Stars: 17
- Watchers: 6
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rollbar
[](https://github.com/gin-contrib/rollbar/actions/workflows/go.yml)
[](https://codecov.io/gh/gin-contrib/rollbar)
[](https://goreportcard.com/report/github.com/gin-contrib/rollbar)
[](https://godoc.org/github.com/gin-contrib/rollbar)
[](https://gitter.im/gin-gonic/gin)Middleware to integrate with [rollbar](https://rollbar.com/) error monitoring. It uses [rollbar-go](https://github.com/rollbar/rollbar-go) SDK that reports errors and logs messages.
## Usage
Download and install it:
```sh
go get github.com/gin-contrib/rollbar
```Import it in your code:
```go
import "github.com/gin-contrib/rollbar"
```## Example
```go
package mainimport (
"log""github.com/gin-contrib/rollbar"
"github.com/gin-gonic/gin"roll "github.com/rollbar/rollbar-go"
)func main() {
roll.SetToken("MY_TOKEN")
// roll.SetEnvironment("production") // defaults to "development"r := gin.Default()
r.Use(rollbar.Recovery(true))if err := r.Run(":8080"); err != nil {
log.Fatal(err)
}
}
```