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.

Expand ▾ Collapse ▴

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
        Output:
        
        

        func (*Handler) Handle

        func (h *Handler) Handle(err error)

          Handle logs an error.

          func (*Handler) HandleContext

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

            HandleContext logs an error.

            Source Files