modulepackage
0.0.0-20191118090739-a894ea0910a0
Repository: https://github.com/mnrtks/logrusfluent.git
Documentation: pkg.go.dev
# README
logrus-fluent-hook
Fluent Hooks for Logrus
This is a hook to send the log to fluentd.
Usage
import (
log "github.com/Sirupsen/logrus"
"github.com/fluent/fluent-logger-golang/fluent"
"github.com/mnrtks/logrusfluent"
)
func main() {
fluentConf := fluent.Config{}
hook, err := logrusfluent.NewFluentHook(fluentConf)
if err == nil {
hook.DefaultTag = "logrusfluent"
log.AddHook(hook)
}
log.WithFields(log.Fields{
"tag": "hoge",
"animal": "walrus",
"size": 10,
}).Info("A group of walrus emerges from the ocean")
// The default tag is used if you do not specify a tag.
log.WithFields(log.Fields{
"omg": true,
"number": 122,
}).Warn("The group's number increased tremendously!")
}
# Functions
NewFluentHook creates a new hook to send to fluentd.
# Structs
FluentHook to send logs via fluentd.