aboutsummaryrefslogtreecommitdiff
path: root/connector
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-03-04 23:04:01 +0100
committerAlex Auvolat <alex@adnab.me>2020-03-04 23:04:01 +0100
commit3288cea61c7b7338ac996069be367af71bdbcd0f (patch)
tree4d594adf3dc496cc52869d6289b2b62fe95a45e9 /connector
parent979755a324dfccd2dd9e7e861825c9082bede99b (diff)
downloadeasybridge-3288cea61c7b7338ac996069be367af71bdbcd0f.tar.gz
easybridge-3288cea61c7b7338ac996069be367af71bdbcd0f.zip
Don't flood Messenger bridge logs to stderr by default
Diffstat (limited to 'connector')
-rw-r--r--connector/external/config.go4
-rw-r--r--connector/external/external.go5
2 files changed, 5 insertions, 4 deletions
diff --git a/connector/external/config.go b/connector/external/config.go
index bf2a5f8..03e1feb 100644
--- a/connector/external/config.go
+++ b/connector/external/config.go
@@ -1,6 +1,8 @@
package external
import (
+ "os"
+
. "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
)
@@ -30,7 +32,7 @@ func init() {
return &External{
protocol: MESSENGER_PROTOCOL,
command: "./external/messenger.py",
- debug: true,
+ debug: (os.Getenv("EASYBRIDGE_MESSENGER_DEBUG") == "true"),
}
},
Schema: ConfigSchema{
diff --git a/connector/external/external.go b/connector/external/external.go
index 553c657..d4a6caf 100644
--- a/connector/external/external.go
+++ b/connector/external/external.go
@@ -152,12 +152,11 @@ func (ext *External) setupProc(generation int) error {
if ext.debug {
recv = io.TeeReader(recv, os.Stderr)
send = io.MultiWriter(send, os.Stderr)
+ ext.proc.Stderr = os.Stderr
}
ext.sendJson = json.NewEncoder(send)
- ext.proc.Stderr = os.Stderr
-
err = ext.proc.Start()
if err != nil {
return err
@@ -250,7 +249,7 @@ func (ext *External) recvLoop(from io.Reader, generation int) {
break
}
- log.Debugf("GOT MESSAGE: %#v %#v", msg, msg.Data)
+ log.Tracef("GOT MESSAGE: %#v %#v", msg, msg.Data)
if strings.HasPrefix(msg.MsgType, "rep_") {
func() {
ext.lock.Lock()