An open API service indexing awesome lists of open source software.

https://github.com/sytten/logrus-zap-hook

Lorus hook for the zap logger
https://github.com/sytten/logrus-zap-hook

golang logrus zap

Last synced: 4 months ago
JSON representation

Lorus hook for the zap logger

Awesome Lists containing this project

README

        

# Zap Hook for Logrus :walrus:

Use this hook to send logs from [logrus](https://github.com/sirupsen/logrus) to [zap](https://github.com/uber-go/zap).
All levels are sent by default.

## Usage

```go
package main

import (
"io/ioutil"

zaphook "github.com/Sytten/logrus-zap-hook"
"github.com/sirupsen/logrus"
"go.uber.org/zap"
)

func main() {
log := logrus.New()
log.ReportCaller = true // So Zap reports the right caller
log.SetOutput(ioutil.Discard) // Prevent logrus from writing its logs

logger, _ := zap.NewDevelopment()
hook, _ := zaphook.NewZapHook(logger)

log.Hooks.Add(hook)
}
```