logrusly

package module
v0.0.0-...-3235ecc Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2018 License: MIT Imports: 3 Imported by: 15 modules, 13 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Loggly Hooks for Logrus

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

Documentation

Index

Constants

View Source
const (

	// RFC3339Micro represents microseconds/seconds fraction (6 digits)
	// that can be automatically parse by Loggly
	RFC3339Micro = "2006-01-02T15:04:05.999999Z07:00"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogglyHook

type LogglyHook struct {
	// contains filtered or unexported fields
}

LogglyHook to send logs to the Loggly service.

func NewLogglyHook

func NewLogglyHook(token string, host string, level logrus.Level, tags ...string) *LogglyHook

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

func (*LogglyHook) Fire

func (hook *LogglyHook) Fire(entry *logrus.Entry) error

Fire sends the event to Loggly

func (*LogglyHook) Flush

func (hook *LogglyHook) Flush()

Flush sends buffered events to Loggly.

func (*LogglyHook) Levels

func (hook *LogglyHook) Levels() []logrus.Level

Levels returns the list of logging levels that we want to send to Loggly.

func (*LogglyHook) Tag

func (hook *LogglyHook) Tag(tags string)

Tag exposes the go-loggly .Tag() functionality

Jump to

Keyboard shortcuts

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