MCPcopy
hub / github.com/sirupsen/logrus / NewSyslogHook

Function NewSyslogHook

hooks/syslog/syslog.go:23–26  ·  view source on GitHub ↗

Creates a hook to be added to an instance of logger. This is called with `hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_DEBUG, "")` `if err == nil { log.Hooks.Add(hook) }`

(network, raddr string, priority syslog.Priority, tag string)

Source from the content-addressed store, hash-verified

21// `hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_DEBUG, "")`
22// `if err == nil { log.Hooks.Add(hook) }`
23func NewSyslogHook(network, raddr string, priority syslog.Priority, tag string) (*SyslogHook, error) {
24 w, err := syslog.Dial(network, raddr, priority, tag)
25 return &SyslogHook{w, network, raddr}, err
26}
27
28func (hook *SyslogHook) Fire(entry *logrus.Entry) error {
29 line, err := entry.String()

Callers 1

TestLocalhostAddAndPrintFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestLocalhostAddAndPrintFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…