logrusr

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: MIT Imports: 4 Imported by: 4

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

View Source
const (
	PanicLevel = iota - 4
	FatalLevel
	ErrorLevel
	WarnLevel
	InfoLevel
	DebugLevel
	TraceLevel
)

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