A Logrus hook for sending data to NATS
go get github.com/trillium-labs/logrus-nats
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")
}
Based on AMQP handler by vladoatanasov.
Released under the MIT License.