summaryrefslogtreecommitdiffstats
path: root/bridge/bridge.go
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/bridge.go
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/bridge.go')
-rw-r--r--bridge/bridge.go8
1 files changed, 7 insertions, 1 deletions
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