log : update log import

This commit is contained in:
zhangwenjian
2020-07-27 22:37:50 +08:00
parent 61d3e7c080
commit 012a82821e
6 changed files with 13 additions and 8 deletions
+1 -1
View File
@@ -2,8 +2,8 @@ package handler
import ( import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
jwt "go-admin/pkg/jwtauth" jwt "go-admin/pkg/jwtauth"
"log"
"net/http" "net/http"
) )
+8 -3
View File
@@ -1,8 +1,8 @@
package middleware package middleware
import ( import (
"fmt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
mycasbin "go-admin/pkg/casbin" mycasbin "go-admin/pkg/casbin"
"go-admin/pkg/jwtauth" "go-admin/pkg/jwtauth"
_ "go-admin/pkg/jwtauth" _ "go-admin/pkg/jwtauth"
@@ -19,10 +19,15 @@ func AuthCheckRole() gin.HandlerFunc {
tools.HasError(err, "", 500) tools.HasError(err, "", 500)
//检查权限 //检查权限
res, err := e.Enforce(v["rolekey"], c.Request.URL.Path, c.Request.Method) res, err := e.Enforce(v["rolekey"], c.Request.URL.Path, c.Request.Method)
log.Println("----------------", v["rolekey"], c.Request.URL.Path, c.Request.Method)
tools.HasError(err, "", 500) tools.HasError(err, "", 500)
fmt.Printf("%s [INFO] %s %s %s \r\n",
tools.GetCurrentTimeStr(),
c.Request.Method,
c.Request.URL.Path,
v["rolekey"],
)
if res { if res {
c.Next() c.Next()
} else { } else {
+1 -1
View File
@@ -2,7 +2,7 @@ package models
import ( import (
"errors" "errors"
log "github.com/sirupsen/logrus" "log"
orm "go-admin/global" orm "go-admin/global"
"go-admin/tools" "go-admin/tools"
"golang.org/x/crypto/bcrypt" "golang.org/x/crypto/bcrypt"
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"github.com/casbin/casbin/v2/model" "github.com/casbin/casbin/v2/model"
gormAdapter "github.com/casbin/gorm-adapter/v2" gormAdapter "github.com/casbin/gorm-adapter/v2"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
log "github.com/sirupsen/logrus" "log"
"go-admin/global" "go-admin/global"
) )
+1 -1
View File
@@ -2,7 +2,7 @@ package cronjob
import ( import (
"github.com/robfig/cron/v3" "github.com/robfig/cron/v3"
log "github.com/sirupsen/logrus" "log"
tools2 "go-admin/tools" tools2 "go-admin/tools"
) )
+1 -1
View File
@@ -3,7 +3,7 @@ package tools
import ( import (
"fmt" "fmt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus" "log"
jwt "go-admin/pkg/jwtauth" jwt "go-admin/pkg/jwtauth"
) )