[TASK] improve closing on log client

This commit is contained in:
Martin Geno 2017-06-24 13:05:01 +02:00
parent 5f74be54e6
commit 9aa520b8f8
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
1 changed files with 2 additions and 1 deletions

View File

@ -46,8 +46,8 @@ func (l *Logger) Hook(e *log.Entry) {
} }
err := l.conn.WriteJSON(e) err := l.conn.WriteJSON(e)
if err != nil { if err != nil {
log.Error("[logmania] could not send log entry:", err)
l.Close() l.Close()
log.Error("[logmania] could not send log entry:", err)
} }
} }
@ -61,6 +61,7 @@ func (l *Logger) Listen() {
return return
} }
if err != nil { if err != nil {
l.Close()
log.Warn("[logmania] close listener:", err) log.Warn("[logmania] close listener:", err)
} }
} }