From e63032a5fe44db2838fcb4138419ab84013d2f8c Mon Sep 17 00:00:00 2001 From: Silvan Jegen Date: Sat, 18 Feb 2017 07:46:24 +0100 Subject: Print to Stderr --- filter/str/string.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'filter/str') diff --git a/filter/str/string.go b/filter/str/string.go index c3e2213..37f49f6 100644 --- a/filter/str/string.go +++ b/filter/str/string.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "os" "strings" "github.com/Shugyousha/stasher/filter" @@ -40,11 +41,11 @@ func (f *StringFilter) Filter(w *work.Work) *work.Work { err := dec.Decode(&jm) if err == io.EOF { - fmt.Printf("EOF jm: %v\n", jm) + fmt.Fprintf(os.Stderr, "EOF jm: %v\n", jm) return w } if err != nil { - fmt.Printf("Error when decoding JSON: %q\n", err) + fmt.Fprintf(os.Stderr, "Error when decoding JSON: %q\n", err) w.Err = err return w } @@ -62,7 +63,7 @@ func (f *StringFilter) Filter(w *work.Work) *work.Work { if changed { bs, err := json.Marshal(jm) if err != nil { - fmt.Printf("Error when marshalling JSON: %q\n", err) + fmt.Fprintf(os.Stderr, "Error when marshaling JSON: %q\n", err) w.Err = err } else { w.Data = bs -- cgit v1.2.3