Categorygithub.com/bin3377/logrus-datadog-hook
modulepackage
0.0.3
Repository: https://github.com/bin3377/logrus-datadog-hook.git
Documentation: pkg.go.dev

# README

logrus-datadog-hook

Shipping log entries from logrus to Datadog log API HTTP endpoint

Example

    hostName, _ := os.Hostname()
    // Sending log in JSON, batch log every 5 sec and when failure, retry up to 3 times
    hook := NewHook(host, apiKey, 5*time.Second, 3, logrus.TraceLevel, &logrus.JSONFormatter{}, Options{Hostname: hostName})
    l := logrus.New()
    l.Hooks.Add(hook)
    l.WithField("from", "unitest").Infof("TestSendingJSON - %d", i)

# Functions

NewHook - create hook with input.

# Constants

DatadogEUHost - Host For Datadog EU.
DatadogUSHost - Host For Datadog US.

# Variables

Debug - print out debug log if true.

# Structs

Hook is the struct holding connect information to Datadog backend.
Options define the options for Datadog log stream.