Skip to content

Commit

Permalink
Fixes issues #3 and #4
Browse files Browse the repository at this point in the history
  • Loading branch information
zxchris committed Mar 21, 2017
1 parent 740905f commit d5b0f2f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions gofigure.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ import (

// Debug controls log output
var Debug = false
var _ = func() {
var _ = func() (_ struct{}) {
env := os.Getenv("GOFIGURE_DEBUG")
if len(env) > 0 {
Debug, _ = strconv.ParseBool(env)
}

sources.Logger = printf
sources.Debug = Debug
}
return
}()

func printf(message string, args ...interface{}) {
if !Debug {
Expand Down Expand Up @@ -264,10 +265,10 @@ func (gfg *gofiguration) registerFields() error {
default:
gfg.printf("Registering as default type")
for _, o := range gfg.order {
gfg.printf("Registering '%s' for source '%s' with key '%s'", gfi.field, o, kn)
if k, ok := gfi.keys[o]; ok {
kn = k
}
gfg.printf("Registering '%s' for source '%s' with key '%s'", gfi.field, o, kn)
err = Sources[o].Register(kn, "", gfi.keys, gfi.goField.Type)
}
}
Expand Down

0 comments on commit d5b0f2f

Please sign in to comment.