zapsentry

package module
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2020 License: MIT Imports: 4 Imported by: 0

README

Sentry client for zap logger

Zap Core for Sentry

CI Status Go Report Card

Features

  • with stacktrace (this is handy for analysis into Sentry UI)
  • with tests (can always be tests)
  • easy setup

Quick start

Using go mod:

go get github.com/gebv/zapsentry@v2.0.0

Simple example:

// TODO

Version Policy

zapsentry follows semantic versioning for the documented public API on stable releases. v2 is the latest stable version and follows SemVer strictly. Follows changelog.

The library v1 after improved and finalized went into v2. v2 has a module name github.com/gebv/zapsentry/v2 v1 follows TheZeroSlave/zapsentry.

License

MIT, see LICENSE.

Documentation

Index

Constants

This section is empty.

Variables

DefaultOptions commonly used options.

Functions

func NewCore

func NewCore(cfg Configuration, client *sentry.Client) *core

NewCore returns implementation of zapcore.Core.

func Set

func Set(l *zap.Logger, opts ...Option) (*zap.Logger, error)

Set returns logger with sentry client.

func SetWith

func SetWith(l *zap.Logger, cfg Configuration, c *sentry.Client) (*zap.Logger, error)

SetWith returns logger with sentry client.

Types

type Configuration

type Configuration struct {
	ClientOptions sentry.ClientOptions
	Tags          map[string]string

	TraceSkipFrames int
	Stacktrace      bool
	LevelEnabler    zapcore.Level
	FlushTimeout    time.Duration
	Hub             *sentry.Hub
}

Configuration is a minimal set of parameters for Sentry integration.

type Option

type Option func(*Configuration)

func DisableStacktrace

func DisableStacktrace() Option

func EnableStacktrace

func EnableStacktrace() Option

func Enviroment

func Enviroment(env string) Option

Enviroment sets enviroment.

func FlushTimeout

func FlushTimeout(d time.Duration) Option

func IgnoreErrors

func IgnoreErrors(ignoreErrors []string) Option

func LevelEnabler

func LevelEnabler(level zapcore.Level) Option

func Release

func Release(release string) Option

Release sets release.

func SentryHub

func SentryHub(hub *sentry.Hub) Option

func SentryTag

func SentryTag(key, val string) Option

SentryTag add one tag.

func SentryTags

func SentryTags(tags map[string]string) Option

SentryTags sets tags.

func ServerName added in v2.1.0

func ServerName(name string) Option

func TraceSkipFrames

func TraceSkipFrames(i int) Option

func WithSentry

func WithSentry(dsn string, tags map[string]string) Option

Jump to

Keyboard shortcuts

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