summaryrefslogtreecommitdiffstats
path: root/gateway
diff options
context:
space:
mode:
authorDuco van Amstel <duco.vanamstel@gmail.com>2018-12-26 15:16:09 +0100
committerWim <wim@42.be>2018-12-26 15:16:09 +0100
commitda8e415ae1fb899df4fb05a8a81934e205fb4765 (patch)
treefca9a1b2b26c9971cf0e21e8e53ac8014cd77ccf /gateway
parent1b834c6858d6fdb8927f6a75fad2116d6d2bd394 (diff)
downloadmatterbridge-msglm-da8e415ae1fb899df4fb05a8a81934e205fb4765.tar.gz
matterbridge-msglm-da8e415ae1fb899df4fb05a8a81934e205fb4765.tar.bz2
matterbridge-msglm-da8e415ae1fb899df4fb05a8a81934e205fb4765.zip
Use logrus imports instead of log (#662)
Diffstat (limited to 'gateway')
-rw-r--r--gateway/gateway.go10
-rw-r--r--gateway/gateway_test.go3
-rw-r--r--gateway/samechannel/samechannel_test.go4
3 files changed, 8 insertions, 9 deletions
diff --git a/gateway/gateway.go b/gateway/gateway.go
index d6c6fcea..732c9bcb 100644
--- a/gateway/gateway.go
+++ b/gateway/gateway.go
@@ -9,7 +9,7 @@ import (
"github.com/42wim/matterbridge/bridge/config"
"github.com/hashicorp/golang-lru"
"github.com/peterhellberg/emojilib"
- log "github.com/sirupsen/logrus"
+ "github.com/sirupsen/logrus"
)
type Gateway struct {
@@ -31,14 +31,14 @@ type BrMsgID struct {
ChannelID string
}
-var flog *log.Entry
+var flog *logrus.Entry
const (
apiProtocol = "api"
)
func New(cfg config.Gateway, r *Router) *Gateway {
- flog = log.WithFields(log.Fields{"prefix": "gateway"})
+ flog = logrus.WithFields(logrus.Fields{"prefix": "gateway"})
gw := &Gateway{Channels: make(map[string]*config.ChannelInfo), Message: r.Message,
Router: r, Bridges: make(map[string]*bridge.Bridge), Config: r.Config}
cache, _ := lru.New(5000)
@@ -76,8 +76,8 @@ func (gw *Gateway) AddBridge(cfg *config.Bridge) error {
br.Config = gw.Router.Config
br.General = &gw.BridgeValues().General
// set logging
- br.Log = log.WithFields(log.Fields{"prefix": "bridge"})
- brconfig := &bridge.Config{Remote: gw.Message, Log: log.WithFields(log.Fields{"prefix": br.Protocol}), Bridge: br}
+ br.Log = logrus.WithFields(logrus.Fields{"prefix": "bridge"})
+ brconfig := &bridge.Config{Remote: gw.Message, Log: logrus.WithFields(logrus.Fields{"prefix": br.Protocol}), Bridge: br}
// add the actual bridger for this protocol to this bridge using the bridgeMap
br.Bridger = gw.Router.BridgeMap[br.Protocol](brconfig)
}
diff --git a/gateway/gateway_test.go b/gateway/gateway_test.go
index 2e6d828c..cd78fe99 100644
--- a/gateway/gateway_test.go
+++ b/gateway/gateway_test.go
@@ -3,12 +3,11 @@ package gateway
import (
"fmt"
"strconv"
+ "testing"
"github.com/42wim/matterbridge/bridge/config"
"github.com/42wim/matterbridge/gateway/bridgemap"
"github.com/stretchr/testify/assert"
-
- "testing"
)
var testconfig = []byte(`
diff --git a/gateway/samechannel/samechannel_test.go b/gateway/samechannel/samechannel_test.go
index c0e579ae..bbfb0577 100644
--- a/gateway/samechannel/samechannel_test.go
+++ b/gateway/samechannel/samechannel_test.go
@@ -1,10 +1,10 @@
package samechannelgateway
import (
+ "testing"
+
"github.com/42wim/matterbridge/bridge/config"
"github.com/stretchr/testify/assert"
-
- "testing"
)
const testConfig = `