forked from mirror/logrus
Include number of bytes written as debugging output.
This commit is contained in:
parent
29c4caff54
commit
91f92800d7
|
@ -34,6 +34,7 @@ func (hook *PapertrailHook) Fire(entry *logrus.Entry) error {
|
||||||
payload := fmt.Sprintf("<22> %s %s: [%s] %s", date, hook.AppName, entry.Data["level"], entry.Message)
|
payload := fmt.Sprintf("<22> %s %s: [%s] %s", date, hook.AppName, entry.Data["level"], entry.Message)
|
||||||
|
|
||||||
line, err := entry.String()
|
line, err := entry.String()
|
||||||
|
bytesWritten, err := hook.UDPConn.Write([]byte(payload))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Unable to read entry, %v", err)
|
fmt.Fprintf(os.Stderr, "Unable to read entry, %v", err)
|
||||||
return err
|
return err
|
||||||
|
@ -44,6 +45,7 @@ func (hook *PapertrailHook) Fire(entry *logrus.Entry) error {
|
||||||
_, err = hook.UDPConn.Write([]byte(payload))
|
_, err = hook.UDPConn.Write([]byte(payload))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Unable to send log line to Papertrail via UDP, %v", err)
|
fmt.Fprintf(os.Stderr, "Unable to send log line to Papertrail via UDP, %v", err)
|
||||||
|
fmt.Fprintf(os.Stderr, "Unable to send log line to Papertrail via UDP. Wrote %d bytes before error: %v", bytesWritten, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue