Skip to content

Latest commit

 

History

History
45 lines (30 loc) · 1.19 KB

README.md

File metadata and controls

45 lines (30 loc) · 1.19 KB

loggers-mapper-logrus

Golang Loggers mapper for Logrus.

GoDoc Build Status

Pre-recquisite

See https://gopkg.in/birkirb/loggers.v1

Installation

go get github.com/birkirb/loggers-mapper-logrus

Usage

Assuming you are using loggers in your code, and you want to use logrus as your logger implementation. Start by configuring your logrus, and then pass it to the mapper and assign it to your loggers interface (embedded use) or the log.Logger (direct package).

Example

package main

import (
	"os"

	"github.com/sirupsen/logrus"
        "gopkg.in/birkirb/loggers.v1"
        mapper "github.com/birkirb/loggers-mapper-logrus/"
)

// Log is my default logger.
var Log loggers.Contextual

func main() {
	l := logrus.New()
	l.Out = os.Stdout
	l.Level = logrus.InfoLevel

	m := mapper.NewLogger(l)
	Log = &m

	Log.Info("My program has started")
}