Skip to content

Latest commit

History

History
34 lines (25 loc) 路 1.16 KB

File metadata and controls

34 lines (25 loc) 路 1.16 KB

Logrusr

Coverage Status Go Report Card golangci-lint

A logr implementation using logrus.

Usage

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

func main() {
    logrusLog := logrus.New()
    log := logrusr.NewLogger(logrusLog)

    log = log.WithName("MyName").WithValues("user", "you")
    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.