cgroschupp / logzruz

Logrus hook for sending logs to logz.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

logzruz

GoDoc

Logrus hook for sending logs to logz.io.

Package logzruz provides a logrus hook for sending log messages to logz.io servers for further processing.

The library buffers messages until a user-defined threshold has been reached or a ticker triggers a regular buffer flush. By employing two methods of buffer flushing as well as providing a manual way to send messages, applications can utilise faster logging while making sure messages get sent within a reasonable time frame.

As of now, logzruz will send all message levels to logz.io

Installation

go get -u github.com/MorpheusXAUT/logzruz

Usage

logzruz can be added to logrus just like every other hook. Applications are only required to provide an API token for the hook to function:

package main

import (
    "github.com/Sirupsen/logrus"
	"github.com/MorpheusXAUT/logzruz"
)

func main() {
	logz, err := logzruz.NewHook(logzruz.HookOptions{
	    Token: "YOURLOGZIOTOKEN",
	}
	// check for token or URL parsing error
	if err != nil {
	    panic(err)
	}

	log.Hooks.Add(logz)

	log.Info("Hello to logz.io!")
}

Documentation

see https://godoc.org/github.com/MorpheusXAUT/logzruz

Attribution

logrus

Structured, pluggable logging library developed by Sirupsen.

License

MIT License

About

Logrus hook for sending logs to logz.io

License:MIT License


Languages

Language:Go 100.0%