Skip to content

Commit 7790709

Browse files
cosmincojocargcmurphy
authored andcommitted
Discard the logs messages if the quite flag is set (#200)
1 parent 830cb81 commit 7790709

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/gas/main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package main
1717
import (
1818
"flag"
1919
"fmt"
20+
"io/ioutil"
2021
"log"
2122
"os"
2223
"os/user"
@@ -275,7 +276,12 @@ func main() {
275276
log.Fatal(e)
276277
}
277278
}
278-
logger = log.New(logWriter, "[gas] ", log.LstdFlags)
279+
280+
if *flagQuiet {
281+
logger = log.New(ioutil.Discard, "", 0)
282+
} else {
283+
logger = log.New(logWriter, "[gas] ", log.LstdFlags)
284+
}
279285

280286
// Load config
281287
config, err := loadConfig(*flagConfig)

0 commit comments

Comments
 (0)