Skip to content

Commit

Permalink
Add Quiet Flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mykolasmith committed Jun 16, 2017
1 parent 6722361 commit 361376d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

# Please keep the list sorted.

Mykola Smith <[email protected]>
Frank van Rest <[email protected]>
Kevin Malachowski <[email protected]>

9 changes: 9 additions & 0 deletions cmd/cloud_sql_proxy/cloud_sql_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import (

var (
version = flag.Bool("version", false, "Print the version of the proxy and exit")
quiet = flag.Bool("quiet", false, "Disable log messages")

checkRegion = flag.Bool("check_region", false, `If specified, the 'region' portion of the connection string is required for
UNIX socket-based connections.`)
Expand Down Expand Up @@ -102,6 +103,9 @@ Authorization:
flag or set the GOOGLE_APPLICATION_CREDENTIALS environment variable. This
will override gcloud or GCE credentials (if they exist).
General:
-quiet
Disable log messages (e.g. when new connections are established)
Connection:
-instances
Expand Down Expand Up @@ -333,6 +337,11 @@ func main() {
return
}

if *quiet {
log.SetFlags(0)
log.SetOutput(ioutil.Discard)
}

instList := stringList(*instances)
projList := stringList(*projects)
// TODO: it'd be really great to consolidate flag verification in one place.
Expand Down

0 comments on commit 361376d

Please sign in to comment.