summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-02-21 00:20:25 +0100
committerWim <wim@42.be>2018-02-21 00:20:25 +0100
commitd1227b5fc9de9f7a04fbf71292dd224aa8806411 (patch)
tree58d632c586fc3fc13783950f11265552f0f11dd5 /bridge
parent6ea368c383ccc19678623c51d8e4ecbbdb0a64ac (diff)
downloadmatterbridge-msglm-d1227b5fc9de9f7a04fbf71292dd224aa8806411.tar.gz
matterbridge-msglm-d1227b5fc9de9f7a04fbf71292dd224aa8806411.tar.bz2
matterbridge-msglm-d1227b5fc9de9f7a04fbf71292dd224aa8806411.zip
Use prefixed-formatter for better logging
Diffstat (limited to 'bridge')
-rw-r--r--bridge/api/api.go2
-rw-r--r--bridge/bridge.go8
-rw-r--r--bridge/discord/discord.go4
-rw-r--r--bridge/gitter/gitter.go2
-rw-r--r--bridge/irc/irc.go4
-rw-r--r--bridge/matrix/matrix.go2
-rw-r--r--bridge/mattermost/mattermost.go2
-rw-r--r--bridge/rocketchat/rocketchat.go2
-rw-r--r--bridge/slack/slack.go2
-rw-r--r--bridge/sshchat/sshchat.go2
-rw-r--r--bridge/steam/steam.go2
-rw-r--r--bridge/telegram/telegram.go2
-rw-r--r--bridge/xmpp/xmpp.go2
13 files changed, 21 insertions, 15 deletions
diff --git a/bridge/api/api.go b/bridge/api/api.go
index 6055cd5c..cbea9eee 100644
--- a/bridge/api/api.go
+++ b/bridge/api/api.go
@@ -30,7 +30,7 @@ var flog *log.Entry
var protocol = "api"
func init() {
- flog = log.WithFields(log.Fields{"module": protocol})
+ flog = log.WithFields(log.Fields{"prefix": protocol})
}
func New(cfg *config.BridgeConfig) *Api {
diff --git a/bridge/bridge.go b/bridge/bridge.go
index 0a2bfed1..87db37e3 100644
--- a/bridge/bridge.go
+++ b/bridge/bridge.go
@@ -36,6 +36,12 @@ type Bridge struct {
Joined map[string]bool
}
+var flog *log.Entry
+
+func init() {
+ flog = log.WithFields(log.Fields{"prefix": "bridge"})
+}
+
func New(cfg *config.Config, bridge *config.Bridge, c chan config.Message) *Bridge {
b := new(Bridge)
b.Channels = make(map[string]config.ChannelInfo)
@@ -100,7 +106,7 @@ func (b *Bridge) JoinChannels() error {
func (b *Bridge) joinChannels(channels map[string]config.ChannelInfo, exists map[string]bool) error {
for ID, channel := range channels {
if !exists[ID] {
- log.Infof("%s: joining %s (ID: %s)", b.Account, channel.Name, ID)
+ flog.Infof("%s: joining %s (ID: %s)", b.Account, channel.Name, ID)
err := b.JoinChannel(channel)
if err != nil {
return err
diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go
index 70e11e0e..4ca68149 100644
--- a/bridge/discord/discord.go
+++ b/bridge/discord/discord.go
@@ -4,8 +4,8 @@ import (
"bytes"
"github.com/42wim/matterbridge/bridge/config"
"github.com/42wim/matterbridge/bridge/helper"
- log "github.com/sirupsen/logrus"
"github.com/bwmarrin/discordgo"
+ log "github.com/sirupsen/logrus"
"regexp"
"strings"
"sync"
@@ -29,7 +29,7 @@ var flog *log.Entry
var protocol = "discord"
func init() {
- flog = log.WithFields(log.Fields{"module": protocol})
+ flog = log.WithFields(log.Fields{"prefix": protocol})
}
func New(cfg *config.BridgeConfig) *bdiscord {
diff --git a/bridge/gitter/gitter.go b/bridge/gitter/gitter.go
index 9f988f54..f11af6a7 100644
--- a/bridge/gitter/gitter.go
+++ b/bridge/gitter/gitter.go
@@ -21,7 +21,7 @@ var flog *log.Entry
var protocol = "gitter"
func init() {
- flog = log.WithFields(log.Fields{"module": protocol})
+ flog = log.WithFields(log.Fields{"prefix": protocol})
}
func New(cfg *config.BridgeConfig) *Bgitter {
diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go
index d7b45b7f..958eb6c1 100644
--- a/bridge/irc/irc.go
+++ b/bridge/irc/irc.go
@@ -6,11 +6,11 @@ import (
"fmt"
"github.com/42wim/matterbridge/bridge/config"
"github.com/42wim/matterbridge/bridge/helper"
- log "github.com/sirupsen/logrus"
"github.com/lrstanley/girc"
"github.com/paulrosania/go-charset/charset"
_ "github.com/paulrosania/go-charset/data"
"github.com/saintfish/chardet"
+ log "github.com/sirupsen/logrus"
"io"
"io/ioutil"
"net"
@@ -37,7 +37,7 @@ var flog *log.Entry
var protocol = "irc"
func init() {
- flog = log.WithFields(log.Fields{"module": protocol})
+ flog = log.WithFields(log.Fields{"prefix": protocol})
}
func New(cfg *config.BridgeConfig) *Birc {
diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go
index d0b435e6..56616357 100644
--- a/bridge/matrix/matrix.go
+++ b/bridge/matrix/matrix.go
@@ -25,7 +25,7 @@ var flog *log.Entry
var protocol = "matrix"
func init() {
- flog = log.WithFields(log.Fields{"module": protocol})
+ flog = log.WithFields(log.Fields{"prefix": protocol})
}
func New(cfg *config.BridgeConfig) *Bmatrix {
diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go
index 2b93b9bf..bd1292bb 100644
--- a/bridge/mattermost/mattermost.go
+++ b/bridge/mattermost/mattermost.go
@@ -42,7 +42,7 @@ var flog *log.Entry
var protocol = "mattermost"
func init() {
- flog = log.WithFields(log.Fields{"module": protocol})
+ flog = log.WithFields(log.Fields{"prefix": protocol})
}
func New(cfg *config.BridgeConfig) *Bmattermost {
diff --git a/bridge/rocketchat/rocketchat.go b/bridge/rocketchat/rocketchat.go
index 893cea74..dec02e5d 100644
--- a/bridge/rocketchat/rocketchat.go
+++ b/bridge/rocketchat/rocketchat.go
@@ -22,7 +22,7 @@ var flog *log.Entry
var protocol = "rocketchat"
func init() {
- flog = log.WithFields(log.Fields{"module": protocol})
+ flog = log.WithFields(log.Fields{"prefix": protocol})
}
func New(cfg *config.BridgeConfig) *Brocketchat {
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go
index fa49da90..80886446 100644
--- a/bridge/slack/slack.go
+++ b/bridge/slack/slack.go
@@ -40,7 +40,7 @@ var flog *log.Entry
var protocol = "slack"
func init() {
- flog = log.WithFields(log.Fields{"module": protocol})
+ flog = log.WithFields(log.Fields{"prefix": protocol})
}
func New(cfg *config.BridgeConfig) *Bslack {
diff --git a/bridge/sshchat/sshchat.go b/bridge/sshchat/sshchat.go
index 4b91df01..cce4da59 100644
--- a/bridge/sshchat/sshchat.go
+++ b/bridge/sshchat/sshchat.go
@@ -20,7 +20,7 @@ var flog *log.Entry
var protocol = "sshchat"
func init() {
- flog = log.WithFields(log.Fields{"module": protocol})
+ flog = log.WithFields(log.Fields{"prefix": protocol})
}
func New(cfg *config.BridgeConfig) *Bsshchat {
diff --git a/bridge/steam/steam.go b/bridge/steam/steam.go
index 2ce6e0bc..b630c428 100644
--- a/bridge/steam/steam.go
+++ b/bridge/steam/steam.go
@@ -25,7 +25,7 @@ var flog *log.Entry
var protocol = "steam"
func init() {
- flog = log.WithFields(log.Fields{"module": protocol})
+ flog = log.WithFields(log.Fields{"prefix": protocol})
}
func New(cfg *config.BridgeConfig) *Bsteam {
diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go
index 63853578..e411690c 100644
--- a/bridge/telegram/telegram.go
+++ b/bridge/telegram/telegram.go
@@ -21,7 +21,7 @@ var flog *log.Entry
var protocol = "telegram"
func init() {
- flog = log.WithFields(log.Fields{"module": protocol})
+ flog = log.WithFields(log.Fields{"prefix": protocol})
}
func New(cfg *config.BridgeConfig) *Btelegram {
diff --git a/bridge/xmpp/xmpp.go b/bridge/xmpp/xmpp.go
index c2f63e7a..45daee17 100644
--- a/bridge/xmpp/xmpp.go
+++ b/bridge/xmpp/xmpp.go
@@ -22,7 +22,7 @@ var flog *log.Entry
var protocol = "xmpp"
func init() {
- flog = log.WithFields(log.Fields{"module": protocol})
+ flog = log.WithFields(log.Fields{"prefix": protocol})
}
func New(cfg *config.BridgeConfig) *Bxmpp {