diff options
author | Silvan Jegen <s.jegen@gmail.com> | 2017-02-18 07:46:24 +0100 |
---|---|---|
committer | Silvan Jegen <s.jegen@gmail.com> | 2017-02-18 07:46:24 +0100 |
commit | e63032a5fe44db2838fcb4138419ab84013d2f8c (patch) | |
tree | fc6b57b50e4c92d913b30bf4cff7a13ec993bced | |
parent | 1bfb3355633b21bacfce57fde8e922cb9970b6d6 (diff) |
Print to Stderr
-rw-r--r-- | filter/str/string.go | 7 |
1 files changed, 4 insertions, 3 deletions
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 |