aboutsummaryrefslogtreecommitdiff
path: root/appservice
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-17 09:41:08 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-17 09:41:08 +0100
commit400c67f7352371f570e38531d7e033cfe6c87898 (patch)
tree2e02b25a086ceed75930ba2b4248b463bfca7226 /appservice
parentc3b941841e193c1d5c32f9d6226a95475d627249 (diff)
downloadeasybridge-400c67f7352371f570e38531d7e033cfe6c87898.tar.gz
easybridge-400c67f7352371f570e38531d7e033cfe6c87898.zip
Logging; fix xmpp a bit
Diffstat (limited to 'appservice')
-rw-r--r--appservice/account.go3
-rw-r--r--appservice/db.go8
-rw-r--r--appservice/matrix.go13
-rw-r--r--appservice/server.go5
4 files changed, 16 insertions, 13 deletions
diff --git a/appservice/account.go b/appservice/account.go
index 553165a..faf491d 100644
--- a/appservice/account.go
+++ b/appservice/account.go
@@ -2,7 +2,8 @@ package appservice
import (
"fmt"
- "log"
+
+ log "github.com/sirupsen/logrus"
. "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
)
diff --git a/appservice/db.go b/appservice/db.go
index fad78ba..cbd1d11 100644
--- a/appservice/db.go
+++ b/appservice/db.go
@@ -2,15 +2,15 @@ package appservice
import (
"fmt"
- "log"
-
- "git.deuxfleurs.fr/Deuxfleurs/easybridge/mxlib"
- "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
+ log "github.com/sirupsen/logrus"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
_ "github.com/jinzhu/gorm/dialects/postgres"
_ "github.com/jinzhu/gorm/dialects/sqlite"
+
+ "git.deuxfleurs.fr/Deuxfleurs/easybridge/mxlib"
+ "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
)
var db *gorm.DB
diff --git a/appservice/matrix.go b/appservice/matrix.go
index c85861d..88c4b5d 100644
--- a/appservice/matrix.go
+++ b/appservice/matrix.go
@@ -3,12 +3,13 @@ package appservice
import (
"fmt"
"net/url"
- "log"
"net/http"
"time"
"bytes"
"encoding/json"
+ log "github.com/sirupsen/logrus"
+
. "git.deuxfleurs.fr/Deuxfleurs/easybridge/mxlib"
)
@@ -24,7 +25,7 @@ func init() {
}
func mxGetApiCall(endpoint string, response interface{}) error {
- log.Printf("Matrix GET request: %s\n", endpoint)
+ log.Debugf("Matrix GET request: %s\n", endpoint)
req, err := http.NewRequest("GET", config.Server + endpoint, nil)
if err != nil {
@@ -40,7 +41,7 @@ func mxPutApiCall(endpoint string, data interface{}, response interface{}) error
return err
}
- log.Printf("Matrix PUT request: %s %s\n", endpoint, string(body))
+ log.Debugf("Matrix PUT request: %s %s\n", endpoint, string(body))
req, err := http.NewRequest("PUT", config.Server + endpoint, bytes.NewBuffer(body))
if err != nil {
@@ -57,7 +58,7 @@ func mxPostApiCall(endpoint string, data interface{}, response interface{}) erro
return err
}
- log.Printf("Matrix POST request: %s %s\n", endpoint, string(body))
+ log.Debugf("Matrix POST request: %s %s\n", endpoint, string(body))
req, err := http.NewRequest("POST", config.Server + endpoint, bytes.NewBuffer(body))
if err != nil {
@@ -82,7 +83,7 @@ func mxDoAndParse(req *http.Request, response interface{}) error {
if err != nil {
return err
}
- log.Printf("Response (%d): %#v\n", resp.StatusCode, e)
+ log.Debugf("Response (%d): %#v\n", resp.StatusCode, e)
return &e
}
@@ -91,7 +92,7 @@ func mxDoAndParse(req *http.Request, response interface{}) error {
return err
}
- log.Printf("Response: %#v\n", response)
+ log.Debugf("Response: %#v\n", response)
return nil
}
diff --git a/appservice/server.go b/appservice/server.go
index ed206ee..1dc7222 100644
--- a/appservice/server.go
+++ b/appservice/server.go
@@ -4,12 +4,13 @@ import (
"encoding/json"
"fmt"
"strings"
- "log"
"net/http"
+ "github.com/gorilla/mux"
+ log "github.com/sirupsen/logrus"
+
"git.deuxfleurs.fr/Deuxfleurs/easybridge/mxlib"
"git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
- "github.com/gorilla/mux"
)
type Config struct {