logrus2logtail

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 7 Imported by: 0

README

logrus2logtail

Logtail hooks for Logrus

Installation

go get github.com/icoom-lab/logrus2logtail

Usage

package main

import (
	log "github.com/sirupsen/logrus"
	"github.com/icoom-lab/logrus2logtail"
)

func main() {	

	hook, err := logrus2logtail.NewHook("enter_token_here")
	if err != nil {
		log.Error("Error:", err)
	}
	log.AddHook(hook)

	log.WithFields(log.Fields{
		"animal": "walrus",
		"size":   10,
	}).Info("A group of walrus emerges from the ocean")

	log.Debug("This is a debug message")
}

License

logrus2logtail is released under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JSONFormatter = &log.JSONFormatter{}
)

Functions

This section is empty.

Types

type Hooker

type Hooker struct {
	Token string
	// contains filtered or unexported fields
}

func NewHook

func NewHook(Token string) (*Hooker, error)

func (*Hooker) Fire

func (h *Hooker) Fire(entry *log.Entry) error

func (*Hooker) Levels

func (h *Hooker) Levels() []log.Level

Jump to

Keyboard shortcuts

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