summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd
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)
commit7506bd000e605d2f8c4f7069e1fbf9e6022e3e71 (patch)
tree2229b83bbb826e12c260f5b0d06137a6d3dab0e2 /src/helsinki.at/rhimportd
parentbdebcd19be4bee9d0011c86beffc14a3bb70f680 (diff)
make debug log runtime configurable
Diffstat (limited to 'src/helsinki.at/rhimportd')
-rw-r--r--src/helsinki.at/rhimportd/main.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/helsinki.at/rhimportd/main.go b/src/helsinki.at/rhimportd/main.go
index c6090cb..b449d5c 100644
--- a/src/helsinki.at/rhimportd/main.go
+++ b/src/helsinki.at/rhimportd/main.go
@@ -28,19 +28,24 @@ import (
"flag"
"fmt"
"helsinki.at/rhimport"
+ "io/ioutil"
"log"
"os"
"os/signal"
"sync"
- // "io/ioutil"
)
var (
rhl = log.New(os.Stderr, "[rhimportd]\t", log.LstdFlags)
- rhdl = log.New(os.Stderr, "[rhimportd-dbg]\t", log.LstdFlags)
- //rhdl = log.New(ioutil.Discard, "[rhimportd-dbg]\t", log.LstdFlags)
+ rhdl = log.New(ioutil.Discard, "[rhimportd-dbg]\t", log.LstdFlags)
)
+func init() {
+ if _, exists := os.LookupEnv("RHIMPORTD_DEBUG"); exists {
+ rhdl.SetOutput(os.Stderr)
+ }
+}
+
type envStringValue string
func newEnvStringValue(key, dflt string) *envStringValue {