Skip to content

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

License

Notifications You must be signed in to change notification settings

comail/cologrus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

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

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages