logrus_rollbar

package module
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 11 Imported by: 6

README

Rollbar Hook for Logrus v1.4.2

Setup

go get github.com/Scalingo/logrus-rollbar

Example

package main

import (
	"fmt"
	"net/http"
	"math/rand"

	"github.com/sirupsen/logrus"
	"github.com/stvp/rollbar"

	logrusrollbar "github.com/Scalingo/logrus-rollbar"
)


func main() {
	rollbar.ApiKey = "123456ABCD"
	rollbar.Environment = "testing"

	logger := logrus.New()
	logger.Hooks.Add(logrusrollbar.Hook{})

	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		err := fmt.Errorf("something wrong happened in the database")

		logger.WithFields(
			logrus.Fields{"req": r, "error": err, "extra-data", rand.Int()},
		).Error("Something is really wrong")
	})

	http.ListenAndServe(":31313", nil)
}

Release a New Version

Bump new version number in:

  • CHANGELOG.md
  • README.md

Commit, tag and create a new release:

version="1.4.2"

git switch --create release/${version}
git add CHANGELOG.md README.md
git commit --message="Bump v${version}"
git push --set-upstream origin release/${version}
gh pr create --reviewer=EtienneM --title "$(git log -1 --pretty=%B)"

Once the pull request merged, you can tag the new release.

git tag v${version}
git push origin master v${version}
gh release create v${version}

The title of the release should be the version number and the text of the release is the same as the changelog.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SeverityCritical = "critical"
	ErrgoStackSkip   = 15
)

Functions

func New

func New() logrus.Hook

func Wrap

func Wrap(msg string, err error) wrappedError

Types

type RollbarSender

type RollbarSender struct{}

func (RollbarSender) Error

func (s RollbarSender) Error(severity string, err error, fields map[string]interface{})

func (RollbarSender) RequestError

func (s RollbarSender) RequestError(severity string, req *http.Request, err error, fields map[string]interface{})

type Sender

type Sender interface {
	RequestError(string, *http.Request, error, map[string]interface{})
	Error(string, error, map[string]interface{})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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