Skip to content

Commit

Permalink
Use InitLogger instead
Browse files Browse the repository at this point in the history
  • Loading branch information
jbriggs-zvelo committed May 7, 2015
1 parent 68c0a34 commit 5d357b7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions envetcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ func init() {
// that it has been configured properly through other means such as environment
// variables or command line flags.
func Set(service string) error {
util.InitLogger("WARN")

etcdEndpoint := os.Getenv("ETCD_ENDPOINT")

useSync := true
Expand Down Expand Up @@ -123,9 +125,7 @@ func Set(service string) error {
return err
}

if keyPairs["LOG_LEVEL"] == "DEBUG" {
log.Printf("[DEBUG] envetcd: %v => %v\n", "ETCD_ENDPOINT", etcdEndpoint)
}
log.Printf("[DEBUG] envetcd: %v => %v\n", "ETCD_ENDPOINT", etcdEndpoint)
keyPairs["ETCD_ENDPOINT"] = etcdEndpoint

for key, value := range keyPairs {
Expand Down Expand Up @@ -205,10 +205,10 @@ func GetKeyPairs(config *Config) (KeyPairs, error) {
}
sort.Strings(keys)

if keyPairs["LOG_LEVEL"] == "DEBUG" {
for _, key := range keys {
log.Printf("[DEBUG] envetcd: %v => %v\n", key, keyPairs[key])
}
util.InitLogger(keyPairs["LOG_LEVEL"])

for _, key := range keys {
log.Printf("[DEBUG] envetcd: %v => %v\n", key, keyPairs[key])
}

return keyPairs, nil
Expand Down

0 comments on commit 5d357b7

Please sign in to comment.