diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-01-03 19:15:47 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-01-03 19:15:47 (GMT) |
commit | 7506bd000e605d2f8c4f7069e1fbf9e6022e3e71 (patch) | |
tree | 2229b83bbb826e12c260f5b0d06137a6d3dab0e2 /src/helsinki.at/rhimport | |
parent | bdebcd19be4bee9d0011c86beffc14a3bb70f680 (diff) |
make debug log runtime configurable
Diffstat (limited to 'src/helsinki.at/rhimport')
-rw-r--r-- | src/helsinki.at/rhimport/core.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/helsinki.at/rhimport/core.go b/src/helsinki.at/rhimport/core.go index 1824db1..58633d8 100644 --- a/src/helsinki.at/rhimport/core.go +++ b/src/helsinki.at/rhimport/core.go @@ -25,9 +25,9 @@ package rhimport import ( - // "io/ioutil" "fmt" "github.com/golang-basic/go-curl" + "io/ioutil" "log" "os" ) @@ -40,11 +40,13 @@ const ( var ( bool2str = map[bool]string{false: "0", true: "1"} rhl = log.New(os.Stderr, "[rhimport]\t", log.LstdFlags) - rhdl = log.New(os.Stderr, "[rhimport-dbg]\t", log.LstdFlags) - //rhdl = log.New(ioutil.Discard, "[rhimport-dbg]\t", log.LstdFlags) + rhdl = log.New(ioutil.Discard, "[rhimport-dbg]\t", log.LstdFlags) ) func init() { + if _, exists := os.LookupEnv("RHIMPORT_DEBUG"); exists { + rhdl.SetOutput(os.Stderr) + } curl.GlobalInit(curl.GLOBAL_ALL) fetcherInit() } |