Don't flood Messenger bridge logs to stderr by default

This commit is contained in:
Alex 2020-03-04 23:04:01 +01:00
parent 979755a324
commit 3288cea61c
4 changed files with 9 additions and 6 deletions

View file

@ -188,6 +188,7 @@ func (a *Account) ezbrMessagef(format string, args ...interface{}) {
}
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)
err := a.Conn.Configure(a.Config)

View file

@ -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{

View file

@ -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()

View file

@ -234,6 +234,8 @@ class MessengerBridge:
self.client.setBridge(self)
self.my_user_id = self.getUserIdFromUid(self.client.uid)
threads = self.client.fetchThreadList()
# ensure we have a correct mapping for bridged user IDs to fb uids
# (this should be fast)
@ -252,8 +254,7 @@ class MessengerBridge:
self.close()
elif ty == GET_USER:
userId = self.getUserIdFromUid(self.client.uid)
return {"_type": REP_OK, "user": userId}
return {"_type": REP_OK, "user": self.my_user_id}
elif ty == JOIN:
self.ensure_i_joined(cmd["room"])