Skip to content

birkirb/loggers-mapper-logrus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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")
}

About

Golang Loggers mapper for Logrus.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages