cologrus

package module
Version: v0.0.0-...-73297b7 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2015 License: MIT Imports: 3 Imported by: 0

README

Build Status godoc reference

Package cologrus provides functionality to wrap Logrus hooks and formatters as ready to use CoLog hooks and formatters.

Example

package main

import (
	"log"

	"github.com/Sirupsen/logrus"
	"github.com/Sirupsen/logrus/hooks/sentry"

	"comail.io/go/colog"
	"comail.io/go/cologrus"
)

func main() {
	colog.Register()
	colog.ParseFields(true)

	hook, err := logrus_sentry.NewSentryHook("... sentry DNS ...", []logrus.Level{
		logrus.PanicLevel,
		logrus.FatalLevel,
		logrus.ErrorLevel,
	})
	if err != nil {
		panic(err)
	}

	colog.AddHook(cologrus.NewLogrusHook(hook))
	colog.SetFormatter(cologrus.NewLogrusFormatter(new(logrus.TextFormatter)))
	
	log.Println("error: this is bad foo=bar")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogrusFormatter

func NewLogrusFormatter(formatter logrus.Formatter) colog.Formatter

NewLogrusFormatter takes a Logrus formatter and returns it wrapped as a CoLog formatter

func NewLogrusHook

func NewLogrusHook(hook logrus.Hook) colog.Hook

NewLogrusHook takes a Logrus hook and returns it wrapped as a CoLog hook

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

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