Don't flood Messenger bridge logs to stderr by default
This commit is contained in:
parent
979755a324
commit
3288cea61c
4 changed files with 9 additions and 6 deletions
|
@ -188,6 +188,7 @@ func (a *Account) ezbrMessagef(format string, args ...interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Account) connect() {
|
func (a *Account) connect() {
|
||||||
|
log.Printf("Connecting %s %s (%s)", a.MatrixUser, a.AccountName, a.Protocol)
|
||||||
ezbrSystemSendf(a.MatrixUser, "Connecting to account %s (%s)", a.AccountName, a.Protocol)
|
ezbrSystemSendf(a.MatrixUser, "Connecting to account %s (%s)", a.AccountName, a.Protocol)
|
||||||
|
|
||||||
err := a.Conn.Configure(a.Config)
|
err := a.Conn.Configure(a.Config)
|
||||||
|
|
4
connector/external/config.go
vendored
4
connector/external/config.go
vendored
|
@ -1,6 +1,8 @@
|
||||||
package external
|
package external
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
. "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
|
. "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -30,7 +32,7 @@ func init() {
|
||||||
return &External{
|
return &External{
|
||||||
protocol: MESSENGER_PROTOCOL,
|
protocol: MESSENGER_PROTOCOL,
|
||||||
command: "./external/messenger.py",
|
command: "./external/messenger.py",
|
||||||
debug: true,
|
debug: (os.Getenv("EASYBRIDGE_MESSENGER_DEBUG") == "true"),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Schema: ConfigSchema{
|
Schema: ConfigSchema{
|
||||||
|
|
5
connector/external/external.go
vendored
5
connector/external/external.go
vendored
|
@ -152,12 +152,11 @@ func (ext *External) setupProc(generation int) error {
|
||||||
if ext.debug {
|
if ext.debug {
|
||||||
recv = io.TeeReader(recv, os.Stderr)
|
recv = io.TeeReader(recv, os.Stderr)
|
||||||
send = io.MultiWriter(send, os.Stderr)
|
send = io.MultiWriter(send, os.Stderr)
|
||||||
|
ext.proc.Stderr = os.Stderr
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.sendJson = json.NewEncoder(send)
|
ext.sendJson = json.NewEncoder(send)
|
||||||
|
|
||||||
ext.proc.Stderr = os.Stderr
|
|
||||||
|
|
||||||
err = ext.proc.Start()
|
err = ext.proc.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -250,7 +249,7 @@ func (ext *External) recvLoop(from io.Reader, generation int) {
|
||||||
break
|
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_") {
|
if strings.HasPrefix(msg.MsgType, "rep_") {
|
||||||
func() {
|
func() {
|
||||||
ext.lock.Lock()
|
ext.lock.Lock()
|
||||||
|
|
5
external/messenger.py
vendored
5
external/messenger.py
vendored
|
@ -234,6 +234,8 @@ class MessengerBridge:
|
||||||
|
|
||||||
self.client.setBridge(self)
|
self.client.setBridge(self)
|
||||||
|
|
||||||
|
self.my_user_id = self.getUserIdFromUid(self.client.uid)
|
||||||
|
|
||||||
threads = self.client.fetchThreadList()
|
threads = self.client.fetchThreadList()
|
||||||
# ensure we have a correct mapping for bridged user IDs to fb uids
|
# ensure we have a correct mapping for bridged user IDs to fb uids
|
||||||
# (this should be fast)
|
# (this should be fast)
|
||||||
|
@ -252,8 +254,7 @@ class MessengerBridge:
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
elif ty == GET_USER:
|
elif ty == GET_USER:
|
||||||
userId = self.getUserIdFromUid(self.client.uid)
|
return {"_type": REP_OK, "user": self.my_user_id}
|
||||||
return {"_type": REP_OK, "user": userId}
|
|
||||||
|
|
||||||
elif ty == JOIN:
|
elif ty == JOIN:
|
||||||
self.ensure_i_joined(cmd["room"])
|
self.ensure_i_joined(cmd["room"])
|
||||||
|
|
Loading…
Reference in a new issue