Skip to content
Loggly Hooks for GO Logrus logger
Branch: master
Clone or download
sebest Merge pull request #13 from aunsira/all-levels
Use`AllLevels` for exposing all logging levels
Latest commit 3235ecc Mar 16, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Fix LICENSE to be MIT Sep 22, 2015
README.md Update README.md Jun 20, 2017
hook.go Using `AllLevels` for exposing all logging levels Nov 14, 2017

README.md

Loggly Hooks for Logrus :walrus:

Usage

package main

import (
	"github.com/sirupsen/logrus"
	"github.com/sebest/logrusly"
)

var logglyToken string = "YOUR_LOGGLY_TOKEN"

func main() {
	log := logrus.New()
	hook := logrusly.NewLogglyHook(logglyToken, "www.hostname.com", logrus.WarnLevel, "tag1", "tag2")
	log.Hooks.Add(hook)

	log.WithFields(logrus.Fields{
		"name": "joe",
		"age":  42,
	}).Error("Hello world!")

	// Flush is automatic for panic/fatal
	// Just make sure to Flush() before exiting or you may loose up to 5 seconds
	// worth of messages.
	hook.Flush()
}
You can’t perform that action at this time.