Categorygithub.com/nullseed/logruseq
modulepackage
0.0.0-20191022112445-275e5c09bb04
Repository: https://github.com/nullseed/logruseq.git
Documentation: pkg.go.dev

# README

Logruseq

A Seq hook for Logrus

Build Status Go Report Card GoDoc

Install

go get -u github.com/nullseed/logruseq

Usage

package main

import (
	"github.com/nullseed/logruseq"
	log "github.com/sirupsen/logrus"
)

func main() {
	log.AddHook(logruseq.NewSeqHook("http://localhost:5341"))

	// Or optionally use the hook with an API key:
	// log.AddHook(logruseq.NewSeqHook("http://localhost:5341",
	// 	logruseq.OptionAPIKey("N1ncujiT5pYGD6m4CF0")))

	log.WithFields(log.Fields{
		"animal": "walrus",
	}).Info("A walrus appears")
}

# Packages

No description provided by the author

# Functions

NewSeqHook creates a Seq hook for logrus which can send log events to the host specified, for example: logruseq.NewSeqHook("http://localhost:5341") Optionally, the hook can be used with an API key, for example: logruseq.NewSeqHook("http://localhost:5341", logruseq.OptionAPIKey("N1ncujiT5pYGD6m4CF0")) Optionally, which levels to log can be specified: logruseq.NewSeqHook("http://localhost:5341", logruseq.OptionLevels([]logrus.Level{ logrus.WarnLevel, logrus.ErrorLevel, logrus.FatalLevel, logrus.PanicLevel, })).
OptionAPIKey sets the Seq API key option.
OptionLevels sets the levels for which Fire will be called.

# Structs

SeqHook sends logs to Seq via HTTP.
SeqHookOptions collects non-default Seq hook options.