Skip to content

Commit

Permalink
Add a -silent option
Browse files Browse the repository at this point in the history
  • Loading branch information
mpchadwick committed Nov 4, 2020
1 parent 2e2abc1 commit b77dffc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func main() {
requested := flag.String("config", "", "Configuration to use. magento2 is included out-of-box. Alternately, supply path to file")
update := flag.Bool("update", false, "Auto update dbanon to the newest version")
ver := flag.Bool("version", false, "Get current version")
silent := flag.Bool("silent", false, "Disable all logging")

flag.Parse()

Expand All @@ -53,8 +54,13 @@ func main() {
}

dbanonLogger := dbanon.GetLogger()
file, _ := os.OpenFile("dbanon.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
dbanonLogger.Out = file
if !*silent {
file, _ := os.OpenFile("dbanon.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
dbanonLogger.SetOutput(file)
} else {
dbanonLogger.SetOutput(ioutil.Discard)
}


config, err := dbanon.NewConfig(*requested)
if err != nil {
Expand Down

0 comments on commit b77dffc

Please sign in to comment.