Categorygithub.com/lwangrabbit/logrusr
modulepackage
1.2.0
Repository: https://github.com/lwangrabbit/logrusr.git
Documentation: pkg.go.dev

# README

Logrusr

Coverage Status Go Report Card golangci-lint

A logr implementation using logrus.

Usage

import (
    "github.com/sirupsen/logrus"
    "github.com/bombsimon/logrusr"
    "github.com/go-logr/logr"
)

func main() {
    var log logr.Logger

    log = logrusr.NewLogger(logrus.New())

    log.Info("Logr in action!", "the answer", 42)
}

For more details, see example.

Implementation details

The NewLogger method takes a logrus.FieldLogger interface as input which means this works with both logrus.Logger and logrus.Entry. This is currently a quite naive implementation in early state. Use with caution.

# Packages

No description provided by the author

# Functions

NewLogger will return a new logr.Logger from a logrus.FieldLogger.
NewLoggerWithFormatter will return a new logr.Logger from a logrus.FieldLogger that uses provided function to format complex data types.