diff options
author | Duco van Amstel <duco.vanamstel@gmail.com> | 2018-12-26 15:16:09 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2018-12-26 15:16:09 +0100 |
commit | da8e415ae1fb899df4fb05a8a81934e205fb4765 (patch) | |
tree | fca9a1b2b26c9971cf0e21e8e53ac8014cd77ccf /bridge | |
parent | 1b834c6858d6fdb8927f6a75fad2116d6d2bd394 (diff) | |
download | matterbridge-msglm-da8e415ae1fb899df4fb05a8a81934e205fb4765.tar.gz matterbridge-msglm-da8e415ae1fb899df4fb05a8a81934e205fb4765.tar.bz2 matterbridge-msglm-da8e415ae1fb899df4fb05a8a81934e205fb4765.zip |
Use logrus imports instead of log (#662)
Diffstat (limited to 'bridge')
-rw-r--r-- | bridge/bridge.go | 10 | ||||
-rw-r--r-- | bridge/config/config.go | 14 | ||||
-rw-r--r-- | bridge/helper/helper.go | 6 | ||||
-rw-r--r-- | bridge/sshchat/sshchat.go | 4 |
4 files changed, 17 insertions, 17 deletions
diff --git a/bridge/bridge.go b/bridge/bridge.go index debe2d62..336e2e2c 100644 --- a/bridge/bridge.go +++ b/bridge/bridge.go @@ -1,10 +1,10 @@ package bridge import ( - "github.com/42wim/matterbridge/bridge/config" - log "github.com/sirupsen/logrus" - "strings" + + "github.com/42wim/matterbridge/bridge/config" + "github.com/sirupsen/logrus" ) type Bridger interface { @@ -21,7 +21,7 @@ type Bridge struct { Protocol string Channels map[string]config.ChannelInfo Joined map[string]bool - Log *log.Entry + Log *logrus.Entry Config config.Config General *config.Protocol } @@ -29,7 +29,7 @@ type Bridge struct { type Config struct { // General *config.Protocol Remote chan config.Message - Log *log.Entry + Log *logrus.Entry *Bridge } diff --git a/bridge/config/config.go b/bridge/config/config.go index eb34912d..b32db7da 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -9,7 +9,7 @@ import ( "github.com/fsnotify/fsnotify" prefixed "github.com/matterbridge/logrus-prefixed-formatter" - log "github.com/sirupsen/logrus" + "github.com/sirupsen/logrus" "github.com/spf13/viper" ) @@ -197,12 +197,12 @@ type config struct { } func NewConfig(cfgfile string) Config { - log.SetFormatter(&prefixed.TextFormatter{PrefixPadding: 13, DisableColors: true, FullTimestamp: false}) - flog := log.WithFields(log.Fields{"prefix": "config"}) + logrus.SetFormatter(&prefixed.TextFormatter{PrefixPadding: 13, DisableColors: true, FullTimestamp: false}) + flog := logrus.WithFields(logrus.Fields{"prefix": "config"}) viper.SetConfigFile(cfgfile) input, err := getFileContents(cfgfile) if err != nil { - log.Fatal(err) + logrus.Fatal(err) } mycfg := newConfigFromString(input) if mycfg.cv.General.MediaDownloadSize == 0 { @@ -218,7 +218,7 @@ func NewConfig(cfgfile string) Config { func getFileContents(filename string) ([]byte, error) { input, err := ioutil.ReadFile(filename) if err != nil { - log.Fatal(err) + logrus.Fatal(err) return []byte(nil), err } return input, nil @@ -236,13 +236,13 @@ func newConfigFromString(input []byte) *config { viper.AutomaticEnv() err := viper.ReadConfig(bytes.NewBuffer(input)) if err != nil { - log.Fatal(err) + logrus.Fatal(err) } cfg := &BridgeValues{} err = viper.Unmarshal(cfg) if err != nil { - log.Fatal(err) + logrus.Fatal(err) } return &config{ v: viper.GetViper(), diff --git a/bridge/helper/helper.go b/bridge/helper/helper.go index c1a48ce8..d9acb3d5 100644 --- a/bridge/helper/helper.go +++ b/bridge/helper/helper.go @@ -11,7 +11,7 @@ import ( "unicode/utf8" "github.com/42wim/matterbridge/bridge/config" - log "github.com/sirupsen/logrus" + "github.com/sirupsen/logrus" ) func DownloadFile(url string) (*[]byte, error) { @@ -97,7 +97,7 @@ func GetAvatar(av map[string]string, userid string, general *config.Protocol) st return "" } -func HandleDownloadSize(flog *log.Entry, msg *config.Message, name string, size int64, general *config.Protocol) error { +func HandleDownloadSize(flog *logrus.Entry, msg *config.Message, name string, size int64, general *config.Protocol) error { // check blacklist here for _, entry := range general.MediaDownloadBlackList { if entry != "" { @@ -120,7 +120,7 @@ func HandleDownloadSize(flog *log.Entry, msg *config.Message, name string, size return nil } -func HandleDownloadData(flog *log.Entry, msg *config.Message, name, comment, url string, data *[]byte, general *config.Protocol) { +func HandleDownloadData(flog *logrus.Entry, msg *config.Message, name, comment, url string, data *[]byte, general *config.Protocol) { var avatar bool flog.Debugf("Download OK %#v %#v", name, len(*data)) if msg.Event == config.EventAvatarDownload { diff --git a/bridge/sshchat/sshchat.go b/bridge/sshchat/sshchat.go index fc3145e6..ca427a81 100644 --- a/bridge/sshchat/sshchat.go +++ b/bridge/sshchat/sshchat.go @@ -9,7 +9,7 @@ import ( "github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/helper" "github.com/shazow/ssh-chat/sshd" - log "github.com/sirupsen/logrus" + "github.com/sirupsen/logrus" ) type Bsshchat struct { @@ -131,7 +131,7 @@ func (b *Bsshchat) handleSSHChat() error { res := strings.Split(stripPrompt(b.r.Text()), ":") if res[0] == "-> Set theme" { wait = false - log.Debugf("mono found, allowing") + logrus.Debugf("mono found, allowing") continue } if !wait { |