# README
Logrusr
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.
# Packages
No description provided by the author
# Functions
New will return a new logr.Logger created from a logrus.FieldLogger.
WithFormatter will set the FormatFunc to use.
WithName will set an initial name instead of having to call `WithName` on the logger itself after constructing it.
WithReportCaller will enable reporting of the caller.
# Type aliases
FormatFunc is the function to format log values with for non primitive data.
Option is options to give when construction a logrusr logger.