summaryrefslogtreecommitdiffstats
path: root/matterclient/matterclient.go
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 /matterclient/matterclient.go
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 'matterclient/matterclient.go')
-rw-r--r--matterclient/matterclient.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go
index f15b1d1b..07994c61 100644
--- a/matterclient/matterclient.go
+++ b/matterclient/matterclient.go
@@ -12,7 +12,7 @@ import (
"github.com/jpillora/backoff"
prefixed "github.com/matterbridge/logrus-prefixed-formatter"
"github.com/mattermost/mattermost-server/model"
- log "github.com/sirupsen/logrus"
+ "github.com/sirupsen/logrus"
)
type Credentials struct {
@@ -55,7 +55,7 @@ type MMClient struct {
User *model.User
Users map[string]*model.User
MessageChan chan *Message
- log *log.Entry
+ log *logrus.Entry
WsClient *websocket.Conn
WsQuit bool
WsAway bool
@@ -70,23 +70,23 @@ type MMClient struct {
func New(login, pass, team, server string) *MMClient {
cred := &Credentials{Login: login, Pass: pass, Team: team, Server: server}
mmclient := &MMClient{Credentials: cred, MessageChan: make(chan *Message, 100), Users: make(map[string]*model.User)}
- log.SetFormatter(&prefixed.TextFormatter{PrefixPadding: 13, DisableColors: true})
- mmclient.log = log.WithFields(log.Fields{"prefix": "matterclient"})
+ logrus.SetFormatter(&prefixed.TextFormatter{PrefixPadding: 13, DisableColors: true})
+ mmclient.log = logrus.WithFields(logrus.Fields{"prefix": "matterclient"})
mmclient.lruCache, _ = lru.New(500)
return mmclient
}
func (m *MMClient) SetDebugLog() {
- log.SetFormatter(&prefixed.TextFormatter{PrefixPadding: 13, DisableColors: true, FullTimestamp: false, ForceFormatting: true})
+ logrus.SetFormatter(&prefixed.TextFormatter{PrefixPadding: 13, DisableColors: true, FullTimestamp: false, ForceFormatting: true})
}
func (m *MMClient) SetLogLevel(level string) {
- l, err := log.ParseLevel(level)
+ l, err := logrus.ParseLevel(level)
if err != nil {
- log.SetLevel(log.InfoLevel)
+ logrus.SetLevel(logrus.InfoLevel)
return
}
- log.SetLevel(l)
+ logrus.SetLevel(l)
}
func (m *MMClient) Login() error {
@@ -209,7 +209,7 @@ func (m *MMClient) StatusLoop() {
}
if m.WsConnected {
if err := m.checkAlive(); err != nil {
- log.Errorf("Connection is not alive: %#v", err)
+ logrus.Errorf("Connection is not alive: %#v", err)
}
select {
case <-m.WsPingChan:
@@ -222,7 +222,7 @@ func (m *MMClient) StatusLoop() {
m.WsQuit = false
err := m.Login()
if err != nil {
- log.Errorf("Login failed: %#v", err)
+ logrus.Errorf("Login failed: %#v", err)
break
}
if m.OnWsConnect != nil {