XMPP debug output

This commit is contained in:
Martin/Geno 2019-06-06 21:20:51 +02:00
parent aceced844a
commit 5f09a187ce
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
6 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@ type Config struct {
Host string Host string
Connection string Connection string
Secret string Secret string
XMPPLog bool `toml:"xmpp_log"` XMPPDebug bool `toml:"xmpp_debug"`
Special map[string]interface{} Special map[string]interface{}
xmpp *xmpp.Component xmpp *xmpp.Component

View File

@ -91,7 +91,7 @@ func (c *Config) receiving(packet xmpp.Packet) (xmpp.Packet, bool) {
} }
case xmpp.Message: case xmpp.Message:
if c.XMPPLog { if c.XMPPDebug {
logger.WithFields(map[string]interface{}{ logger.WithFields(map[string]interface{}{
"from": p.PacketAttrs.From, "from": p.PacketAttrs.From,
"to": p.PacketAttrs.To, "to": p.PacketAttrs.To,

View File

@ -10,7 +10,7 @@ import (
func TestReceive(t *testing.T) { func TestReceive(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)
c := Config{Host: "example.org", Type: "monkeyservice"} c := Config{Host: "example.org", Type: "monkeyservice", XMPPDebug: true}
// ignoring packet // ignoring packet
p, _ := c.receiving(xmpp.Handshake{}) p, _ := c.receiving(xmpp.Handshake{})

View File

@ -22,7 +22,7 @@ func (c *Config) sending(packet xmpp.Packet) xmpp.Packet {
} else { } else {
p.PacketAttrs.From += "@" + c.Host p.PacketAttrs.From += "@" + c.Host
} }
if c.XMPPLog { if c.XMPPDebug {
logger.WithFields(map[string]interface{}{ logger.WithFields(map[string]interface{}{
"from": p.PacketAttrs.From, "from": p.PacketAttrs.From,
"to": p.PacketAttrs.To, "to": p.PacketAttrs.To,

View File

@ -10,7 +10,7 @@ import (
func TestSend(t *testing.T) { func TestSend(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)
c := Config{Host: "example.org"} c := Config{Host: "example.org", XMPPDebug: true}
// ignoring packet // ignoring packet
p := c.sending(xmpp.IQ{}) p := c.sending(xmpp.IQ{})

View File

@ -5,7 +5,7 @@ type = "threema"
host = "threema.chat.sum7.eu" host = "threema.chat.sum7.eu"
connection = "localhost:5347" connection = "localhost:5347"
secret = "change_me" secret = "change_me"
xmpp_log = false xmpp_debug = false
[component.special] [component.special]
http_upload_url = "https://example.org/upload/threema" http_upload_url = "https://example.org/upload/threema"