sumorus

package module
v1.5.0 Latest Latest
Warning

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

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

README

SumoLogic Hooks for Logrus

Usage

package main

import (
	"github.com/Sirupsen/logrus"
	"github.com/doublefree/sumorus"
)

var endpoint string = "YOUR_SUMOLOGIC_HTTP_HOSTED_ENDPOINT"
var host = "YOUR_HOST_NAME"

func main() {
	log := logrus.New()
	sumoLogicHook := sumorus.NewSumoLogicHook(endpoint, host, logrus.InfoLevel, "tag1", "tag2")
	log.Hooks.Add(sumoLogicHook)

	log.WithFields(logrus.Fields{
		"name": "joe",
		"age":  42,
	}).Error("Hello world!")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SumoLogicHook

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

func NewSumoLogicHook

func NewSumoLogicHook(endPointUrl string, host string, level logrus.Level, tags ...string) *SumoLogicHook

func (*SumoLogicHook) Fire

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

func (*SumoLogicHook) Levels

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

type SumoLogicMesssage

type SumoLogicMesssage struct {
	Tags  []string    `json:"tags"`
	Host  string      `json:"host"`
	Level string      `json:"level"`
	Data  interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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