diff --git a/controllers/addinvoice.ctrl.go b/controllers/addinvoice.ctrl.go index 395d34c..9d21125 100644 --- a/controllers/addinvoice.ctrl.go +++ b/controllers/addinvoice.ctrl.go @@ -9,7 +9,6 @@ import ( "github.com/bumi/lndhub.go/lib" "github.com/labstack/echo/v4" "github.com/labstack/gommon/random" - "github.com/sirupsen/logrus" ) // AddInvoiceController : Add invoice controller struct @@ -57,7 +56,7 @@ func (AddInvoiceController) AddInvoice(c echo.Context) error { // TODO: move this to a service layer and call a method _, err := db.NewInsert().Model(&invoice).Exec(context.TODO()) if err != nil { - logrus.Errorf("error saving an invoice: %v", err) + c.Logger().Errorf("error saving an invoice: %v", err) // TODO: better error handling, possibly panic and catch in an error handler return c.JSON(http.StatusInternalServerError, nil) } diff --git a/go.mod b/go.mod index 1c1f5e0..7ee2b42 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,6 @@ require ( github.com/kelseyhightower/envconfig v1.4.0 github.com/labstack/echo/v4 v4.6.1 github.com/labstack/gommon v0.3.1 - github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.0 github.com/uptrace/bun v1.0.21 github.com/uptrace/bun/dialect/pgdialect v1.0.21 diff --git a/go.sum b/go.sum index 4e0fdbf..3151636 100644 --- a/go.sum +++ b/go.sum @@ -164,8 +164,6 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFo github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= @@ -271,7 +269,6 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/lib/tokens/jwt.go b/lib/tokens/jwt.go index 3b5625d..bf1ac1e 100644 --- a/lib/tokens/jwt.go +++ b/lib/tokens/jwt.go @@ -12,7 +12,6 @@ import ( "github.com/golang-jwt/jwt" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" - "github.com/sirupsen/logrus" "github.com/uptrace/bun" ) @@ -58,7 +57,7 @@ func UserMiddleware(db *bun.DB) echo.MiddlewareFunc { case errors.Is(err, sql.ErrNoRows): return echo.NewHTTPError(http.StatusNotFound, "user with given ID is not found") case err != nil: - logrus.Errorf("database error: %v", err) + c.Logger().Errorf("database error: %v", err) return echo.NewHTTPError(http.StatusInternalServerError) }