diff options
Diffstat (limited to 'appservice')
-rw-r--r-- | appservice/account.go | 3 | ||||
-rw-r--r-- | appservice/db.go | 8 | ||||
-rw-r--r-- | appservice/matrix.go | 13 | ||||
-rw-r--r-- | appservice/server.go | 5 |
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 { |