mgorus

package module
v0.0.0-...-2972fc3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2016 License: MIT Imports: 6 Imported by: 0

README

Mongodb Hooks for Logrus

Install

$ go get github.com/RIscRIpt/mgorus

TODO

Make usage / example

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

type Hook struct {
	// contains filtered or unexported fields
}

Hook is a wrapper around mgo.Collection, which implements the Fire method, so it can be used as a logrus.Hook

func New

func New(origin string, collection *mgo.Collection) *Hook

New returns a ready-to-use logrus.Hook

Example:

logrus.AddHook(mgorus.New("system", mgo.Database("test").C("logs")))

func (*Hook) Fire

func (h *Hook) Fire(entry *logrus.Entry) error

Fire implements one of logrus.Hook interface methods.

func (*Hook) Levels

func (h *Hook) Levels() []logrus.Level

Levels implements one of logrus.Hook interface methods. Returns a slice of levels, which represent a log level when this Hook must be triggered.

Jump to

Keyboard shortcuts

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