logrus_rollbar

package module
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 11 Imported by: 9 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Rollbar Hook for Logrus v1.4.5

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.5"

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=Scalingo/team-ist --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
errgo command
pkgerrors command

Jump to

Keyboard shortcuts

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