minio/vendor/github.com/weekface/mgorus
Anand Babu (AB) Periasamy 1394d8a7a8 logrus based logger
2015-09-17 23:49:30 -07:00
..
LICENSE logrus based logger 2015-09-17 23:49:30 -07:00
mgorus.go logrus based logger 2015-09-17 23:49:30 -07:00
README.md logrus based logger 2015-09-17 23:49:30 -07:00

Mongodb Hooks for Logrus :walrus:

Install

$ go get github.com/weekface/mgorus

Usage

package main

import (
	"github.com/Sirupsen/logrus"
	"github.com/weekface/mgorus"
)

func main() {
	log := logrus.New()
	hooker, err := mgorus.NewHooker("localhost:27017", "db", "collection")
	if err == nil {
	    log.Hooks.Add(hooker)
	}

	log.WithFields(logrus.Fields{
		"name": "zhangsan",
		"age":  28,
	}).Error("Hello world!")
}

License

MIT