From 7790709b81d1871944ee999e7261e111e17e4156 Mon Sep 17 00:00:00 2001 From: cosmincojocar Date: Mon, 16 Apr 2018 11:41:40 +0200 Subject: [PATCH] Discard the logs messages if the quite flag is set (#200) --- cmd/gas/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/gas/main.go b/cmd/gas/main.go index dc671e4..dcb04c4 100644 --- a/cmd/gas/main.go +++ b/cmd/gas/main.go @@ -17,6 +17,7 @@ package main import ( "flag" "fmt" + "io/ioutil" "log" "os" "os/user" @@ -275,7 +276,12 @@ func main() { log.Fatal(e) } } - logger = log.New(logWriter, "[gas] ", log.LstdFlags) + + if *flagQuiet { + logger = log.New(ioutil.Discard, "", 0) + } else { + logger = log.New(logWriter, "[gas] ", log.LstdFlags) + } // Load config config, err := loadConfig(*flagConfig)