Categorygithub.com/dendavidov/logrusly
modulepackage
0.0.1
Repository: https://github.com/dendavidov/logrusly.git
Documentation: pkg.go.dev

# README

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

# Functions

NewLogglyHook creates a Loggly hook to be added to an instance of logger.

# Constants

RFC3339Micro represents microseconds/seconds fraction (6 digits) that can be automatically parse by Loggly.

# Structs

LogglyHook to send logs to the Loggly service.