logrus

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: MIT Imports: 4 Imported by: 3

README

Logrus handler

GitHub Workflow Status Codecov Go Report Card GolangCI Go Version GoDoc

Error handler integration for Logrus.

Installation

go get emperror.dev/handler/logrus

Usage

package main

import (
	"github.com/sirupsen/logrus"

	logrushandler "emperror.dev/handler/logrus"
)

func main() {
	logger := logrus.New()
	handler := logrushandler.New(logger)
}

Development

When all coding and testing is done, please run the test suite:

$ make check

License

The MIT License (MIT). Please see License File for more information.

Documentation

Overview

Package logrus provides Logrus integration.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler logs errors using Logrus.

func New

func New(logger logrus.FieldLogger) *Handler

New creates a new handler.

Example
package main

import (
	"github.com/sirupsen/logrus"

	logrushandler "emperror.dev/handler/logrus"
)

func main() {
	logger := logrus.New()
	_ = logrushandler.New(logger)

}
Output:

func (*Handler) Handle

func (h *Handler) Handle(err error)

Handle logs an error.

func (*Handler) HandleContext added in v0.3.0

func (h *Handler) HandleContext(_ context.Context, err error)

HandleContext logs an error.

Jump to

Keyboard shortcuts

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