Initial QSfera import
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
# Logrusr
|
||||
|
||||
[](https://github.com/bombsimon/logrusr/actions/workflows/go.yml)
|
||||
[](https://coveralls.io/github/bombsimon/logrusr?branch=main)
|
||||
[](https://goreportcard.com/report/github.com/bombsimon/logrusr)
|
||||
|
||||
A [logr](https://github.com/go-logr/logr) implementation using
|
||||
[logrus](https://github.com/sirupsen/logrus).
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
import (
|
||||
"github.com/bombsimon/logrusr/v3"
|
||||
"github.com/go-logr/logr"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func main() {
|
||||
logrusLog := logrus.New()
|
||||
log := logrusr.New(logrusLog)
|
||||
|
||||
log = log.WithName("MyName").WithValues("user", "you")
|
||||
log.Info("Logr in action!", "the answer", 42)
|
||||
}
|
||||
```
|
||||
|
||||
For more details, see [example](example/main.go).
|
||||
|
||||
## Implementation details
|
||||
|
||||
The New 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.
|
||||
Reference in New Issue
Block a user