From be805c67092d2fedc4137f0e51d7c6f7cabddc84 Mon Sep 17 00:00:00 2001 From: Alexandr Morozov Date: Mon, 22 Sep 2014 10:55:46 +0400 Subject: [PATCH] Close logs pipes and catch write errors Signed-off-by: Alexandr Morozov --- jsonlog/jsonlog.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jsonlog/jsonlog.go b/jsonlog/jsonlog.go index ce9c1bb..16d015f 100644 --- a/jsonlog/jsonlog.go +++ b/jsonlog/jsonlog.go @@ -40,6 +40,8 @@ func WriteLog(src io.Reader, dst io.Writer, format string) error { if err != nil { return err } - fmt.Fprintf(dst, "%s", line) + if _, err := io.WriteString(dst, line); err != nil { + return err + } } }