Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 577 Bytes

README.md

File metadata and controls

14 lines (11 loc) · 577 Bytes

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)