Skip to content

Commit

Permalink
remove --quiet, --debug and --verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Fisher committed Apr 10, 2015
1 parent 80f7c72 commit d5184f5
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 59 deletions.
25 changes: 0 additions & 25 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var (
clientKey string
confdir string
config Config // holds the global confd config.
debug bool
interval int
keepStageFile bool
logLevel string
Expand All @@ -35,12 +34,10 @@ var (
onetime bool
prefix string
printVersion bool
quiet bool
scheme string
srvDomain string
templateConfig template.Config
backendsConfig backends.Config
verbose bool
watch bool
)

Expand All @@ -52,14 +49,11 @@ type Config struct {
ClientCert string `toml:"client_cert"`
ClientKey string `toml:"client_key"`
ConfDir string `toml:"confdir"`
Debug bool `toml:"debug"`
Interval int `toml:"interval"`
Noop bool `toml:"noop"`
Prefix string `toml:"prefix"`
Quiet bool `toml:"quiet"`
SRVDomain string `toml:"srv_domain"`
Scheme string `toml:"scheme"`
Verbose bool `toml:"verbose"`
LogLevel string `toml:"log-level"`
Watch bool `toml:"watch"`
}
Expand All @@ -71,7 +65,6 @@ func init() {
flag.StringVar(&clientKey, "client-key", "", "the client key")
flag.StringVar(&confdir, "confdir", "/etc/confd", "confd conf directory")
flag.StringVar(&configFile, "config-file", "", "the confd config file")
flag.BoolVar(&debug, "debug", false, "enable debug logging")
flag.IntVar(&interval, "interval", 600, "backend polling interval")
flag.BoolVar(&keepStageFile, "keep-stage-file", false, "keep staged files")
flag.StringVar(&logLevel, "log-level", "", "level which confd should log messages")
Expand All @@ -80,10 +73,8 @@ func init() {
flag.BoolVar(&onetime, "onetime", false, "run once and exit")
flag.StringVar(&prefix, "prefix", "/", "key path prefix")
flag.BoolVar(&printVersion, "version", false, "print version and exit")
flag.BoolVar(&quiet, "quiet", false, "enable quiet logging")
flag.StringVar(&scheme, "scheme", "http", "the backend URI scheme (http or https)")
flag.StringVar(&srvDomain, "srv-domain", "", "the name of the resource record")
flag.BoolVar(&verbose, "verbose", false, "enable verbose logging")
flag.BoolVar(&watch, "watch", false, "enable watch support")
}

Expand Down Expand Up @@ -122,16 +113,6 @@ func initConfig() error {
// Update config from commandline flags.
processFlags()

// Configure logging.
if config.Quiet {
log.SetQuiet()
}
if config.Verbose {
log.SetVerbose()
}
if config.Debug {
log.SetDebug()
}
if config.LogLevel != "" {
log.SetLevel(config.LogLevel)
}
Expand Down Expand Up @@ -220,8 +201,6 @@ func setConfigFromFlag(f *flag.Flag) {
switch f.Name {
case "backend":
config.Backend = backend
case "debug":
config.Debug = debug
case "client-cert":
config.ClientCert = clientCert
case "client-key":
Expand All @@ -238,14 +217,10 @@ func setConfigFromFlag(f *flag.Flag) {
config.Noop = noop
case "prefix":
config.Prefix = prefix
case "quiet":
config.Quiet = quiet
case "scheme":
config.Scheme = scheme
case "srv-domain":
config.SRVDomain = srvDomain
case "verbose":
config.Verbose = verbose
case "log-level":
config.LogLevel = logLevel
case "watch":
Expand Down
3 changes: 0 additions & 3 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ func TestInitConfigDefaultConfig(t *testing.T) {
ClientCert: "",
ClientKey: "",
ConfDir: "/etc/confd",
Debug: false,
Interval: 600,
Noop: false,
Prefix: "/",
Quiet: false,
SRVDomain: "",
Scheme: "http",
Verbose: false,
}
if err := initConfig(); err != nil {
t.Errorf(err.Error())
Expand Down
4 changes: 1 addition & 3 deletions docs/command-line-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@ Usage of confd:
-client-key="": the client key
-confdir="/etc/confd": confd conf directory
-config-file="": the confd config file
-debug=false: enable debug logging
-interval=600: backend polling interval
-keep-stage-file=false: keep staged files
-log-level="": level which confd should log messages
-node=[]: list of backend nodes
-noop=false: only show pending changes
-onetime=false: run once and exit
-prefix="/": key path prefix
-quiet=false: enable quiet logging
-scheme="http": the backend URI scheme (http or https)
-srv-domain="": the name of the resource record
-verbose=false: enable verbose logging
-version=false: print version and exit
-watch=false: enable watch support
```
Expand Down
8 changes: 2 additions & 6 deletions docs/configuration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ Optional:
* `client_cert` (string) - The client cert file.
* `client_key` (string) - The client key file.
* `confdir` (string) - The path to confd configs. ("/etc/confd")
* `debug` (bool) - Enable debug logging.
* `interval` (int) - The backend polling interval in seconds. (600)
* `log-level` (string) - level which confd should log messages ("info")
* `nodes` (array of strings) - List of backend nodes. (["http://127.0.0.1:4001"])
* `noop` (bool) - Enable noop mode. Process all template resources; skip target update.
* `prefix` (string) - The string to prefix to keys. ("/")
* `quiet` (bool) - Enable quiet logging.
* `scheme` (string) - The backend URI scheme. ("http" or "https")
* `srv_domain` (string) - The name of the resource record.
* `verbose` (bool) - Enable verbose logging.
* `watch` (bool) - Enable watch support.

Example:
Expand All @@ -30,15 +28,13 @@ backend = "etcd"
client_cert = "/etc/confd/ssl/client.crt"
client_key = "/etc/confd/ssl/client.key"
confdir = "/etc/confd"
debug = false
log-level = "debug"
interval = 600
nodes = [
"http://127.0.0.1:4001",
]
noop = false
prefix = "/production"
quiet = false
scheme = "https"
srv_domain = "etcd.example.com"
verbose = false
```
2 changes: 1 addition & 1 deletion docs/noop-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ noop = true
### Example

```
confd -onetime -noop -verbose
confd -onetime -noop
```

-
Expand Down
22 changes: 1 addition & 21 deletions log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,7 @@ func SetTag(t string) {
tag = t
}

// SetQuiet sets quiet mode.
//
// TODO (bacongobbler): remove entirely once v0.9.0 lands
func SetQuiet() {
Fatal("--quiet has been deprecated in favour of --log-level")
}

// SetDebug sets debug mode.
//
// TODO (bacongobbler): remove entirely once v0.9.0 lands
func SetDebug() {
Fatal("--debug has been deprecated in favour of --log-level")
}

// SetVerbose sets verbose mode.
//
// TODO (bacongobbler): remove entirely once v0.9.0 lands
func SetVerbose() {
Fatal("--verbose has been deprecated in favour of --log-level")
}

// SetLevel sets the log level. Valid levels are panic, fatal, error, warn, info and debug.
func SetLevel(level string) {
lvl, err := log.ParseLevel(level)
if err != nil {
Expand Down

0 comments on commit d5184f5

Please sign in to comment.