logrushookopentracing

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 2 Imported by: 2

README

installation

go get github.com/maksim-paskal/sentry-logrus-hook

environment

export SENTRY_DSN=https://1234@sentry/1
export JAEGER_AGENT_HOST=localhost
export JAEGER_AGENT_PORT=6831

usage

package main

import (
	"errors"

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

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

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

	log.AddHook(hook)

	log.Info("test info")
	log.WithError(ErrTest).Warn("test warn")
	log.WithError(ErrTest).Error("test error")

	defer hook.Stop()
}

Documentation

Overview

Copyright paskal.maksim@gmail.com Licensed under the Apache License, Version 2.0 (the "License") you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const SpanKey = "span"

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

type Hook struct {
	// contains filtered or unexported fields
}

func NewHook

func NewHook(options Options) (*Hook, error)

create new Hook.

func (*Hook) Fire

func (hook *Hook) Fire(entry *log.Entry) error

func log.Hook.Fire.

func (*Hook) Levels

func (hook *Hook) Levels() []log.Level

func log.Hook.Levels.

type Options

type Options struct {
	LogLevels []log.Level
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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