summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-01-03 19:15:47 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-01-03 19:15:47 (GMT)
commit00a14226835ba540d2c7675d3fac7cc2ab7f7695 (patch)
tree005524712f20dbc14cbac612c8fb1f31dfbb13df
parent1e2e49754634da258811d430a13f86f85a744e61 (diff)
make debug log runtime configurable
-rw-r--r--core.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/core.go b/core.go
index 1824db1..58633d8 100644
--- a/core.go
+++ b/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()
}