logrusr

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: MIT Imports: 4 Imported by: 11

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(l logrus.FieldLogger, name ...string) logr.Logger

NewLogger will return a new logr.Logger from a logrus.FieldLogger.

func NewLoggerWithFormatter

func NewLoggerWithFormatter(l logrus.FieldLogger, formatter func(interface{}) string, name ...string) logr.Logger

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

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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