NATS hook for Logrus - https://github.com/Sirupsen/logrus
Go
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
nats.go

README.md

logrus-nats

Build Status

A Logrus hook for sending data to NATS

Installation

go get github.com/trillium-labs/logrus-nats

Usage

package main

import (
    "github.com/Sirupsen/logrus"
    "github.com/trillium-labs/logrus-nats"
    "os"
)

func main() {
    logrus.SetFormatter(&logrus.JSONFormatter{})

    logrus.SetOutput(os.Stderr)

    servers := []string{"nats://localhost:4222"}
    hook := logrusnats.NewNATSHook(servers, "my-subject")
    logrus.AddHook(hook)

    logrus.Warn("warning")
    logrus.Info("info")
    logrus.Debug("debug")
}

Credits

Based on AMQP handler by vladoatanasov.

License

Released under the MIT License.