mgorus

package module
v0.0.0-...-8b06dc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2015 License: MIT Imports: 4 Imported by: 0

README

Mongodb Hooks for Logrus

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHooker

func NewHooker(mgoUrl, db, collection string) (*hooker, error)

Types

type M

type M bson.M

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL