Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Wrapper for Logrus hooks and formatters to use as CoLog hooks and formatters.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages