hook

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: MIT Imports: 6 Imported by: 0

README

Logrus hook for Sentry

This repository contains a Sentry hook for Logrus. All logs will be sent as breadcrumbs, errors and higher will be sent as exceptions.

Usage

import "github.com/juusujanar/logrus-sentry-hook"

func main() {
    
}

Contributing

All suggestions and pull requests are welcome.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractStacktrace

func ExtractStacktrace(entry *logrus.Entry, event *sentry.Event)

ExtractStacktrace attempts to extract Stacktrace from errors and include it in Sentry event

Types

type SentryHook

type SentryHook struct {
	Client            *sentry.Client
	MinExceptionLevel logrus.Level
	Hostname          string
}

SentryHook stores information that is used by hook for sending data to Sentry

func NewHook

func NewHook(minExceptionLevel logrus.Level, options *sentry.ClientOptions) (*SentryHook, error)

NewHook is triggered at hook creation to define hook and Sentry configuration

func (*SentryHook) Fire

func (hook *SentryHook) Fire(entry *logrus.Entry) error

Fire is called by logrus everytime a log is written

func (*SentryHook) Levels added in v0.1.2

func (hook *SentryHook) Levels() []logrus.Level

Levels outputs all supported logging levels by this hook

Jump to

Keyboard shortcuts

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