secondtruth / go-logger-logrus

πŸ“– Logrus implementation of the Go Logger interface

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Logger interface – Logrus implementation

This library provides an implementation of the Logger interface for Logrus.

Installation

To install go-logger-logrus, use the following command:

go get -u github.com/secondtruth/go-logger-logrus

Quick Start

package main

import (
	"os"

	logruslogger "github.com/secondtruth/go-logger-logrus/logger"
	"github.com/secondtruth/go-logger/logger"
	"github.com/sirupsen/logrus"
)

func main() {
	logrusLog := logrus.New()
	logrusLog.SetFormatter(&logrus.JSONFormatter{})
	logrusLog.SetOutput(os.Stdout)
	logrusLog.SetLevel(logrus.DebugLevel)
	log, _ := logruslogger.NewLogrusLogger(logrusLog)
	
	log.WithFields(logger.Fields{
		"foo": "bar",
	}).Info("message")
}

About

πŸ“– Logrus implementation of the Go Logger interface

License:MIT License


Languages

Language:Go 91.0%Language:Makefile 9.0%