OK Log Hook for Logrus
![codecov](https://camo.githubusercontent.com/8c06ad8da20b8fec238b9fa47eddd26bef07d679d51e032cbe6c4cf3c1f00e31/68747470733a2f2f636f6465636f762e696f2f67682f4f7465747a2f6c6f677275732d6f6b6c6f672d686f6f6b2f6272616e63682f6d61737465722f67726170682f62616467652e737667)
Use this hook to send your logs to OK Log ingest server(s) over TCP.
All logrus fields will be sent as additional fields on OK Log.
The hook must be configured with:
- A OK Log address (a "ip:port" string).
- an optional map with extra global fields. These fields will be included in all messages sent to OK Log
package main
import (
"github.com/otetz/logrus-oklog-hook"
log "github.com/sirupsen/logrus"
)
func main() {
hook := oklog.NewOklogHook([]string{"<oklog_ip>:<oklog_port>"}, map[string]interface{}{"this": "is logged every time"})
log.AddHook(hook)
log.Info("some logging message")
}
package main
import (
"github.com/otetz/logrus-oklog-hook"
log "github.com/sirupsen/logrus"
)
func main() {
hook := oklog.NewAsyncOklogHook([]string{"<oklog_ip>:<oklog_port>"}, map[string]interface{}{"this": "is logged every time"})
defer hook.Flush()
log.AddHook(hook)
log.Info("some logging message")
}