Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/maksim-paskal/logrus-hook-sentry


https://github.com/maksim-paskal/logrus-hook-sentry

Last synced: 5 days ago
JSON representation

Awesome Lists containing this project

README

        

## installation
```
go get github.com/maksim-paskal/logrus-hook-sentry
```
## envieronment
```bash
export SENTRY_DSN=https://[email protected]/345
```

## usage

```go
package main

import (
"errors"

logrushooksentry "github.com/maksim-paskal/logrus-hook-sentry"
log "github.com/sirupsen/logrus"
)

var ErrTest error = errors.New("test error")

func main() {
hook, err := logrushooksentry.NewHook(logrushooksentry.Options{
Release: "test",
})
if err != nil {
log.WithError(err).Fatal()
}

log.AddHook(hook)

log.Info("test info")
log.Warn(ErrTest)
log.WithError(ErrTest).Error("some message")

defer hook.Stop()
}
```