This commit is contained in:
iyear 2020-04-09 15:54:19 +08:00
parent 2540e7524a
commit ec0421000f
2 changed files with 3 additions and 4 deletions

View File

@ -173,11 +173,11 @@ func GetAdmin() []int64 {
return result return result
} }
func InitLogger() { func InitLogger() {
if !PathExists("./log/") { if !PathExists(bLogBasePath) {
os.Mkdir("./log/", 0773) os.Mkdir(bLogBasePath, 0773)
} }
path := "./log/" + time.Now().Format("2006-01-02") + ".log" path := bLogBasePath + time.Now().Format("2006-01-02") + ".log"
f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0773) f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0773)
if err != nil { if err != nil {
logger.Println(err) logger.Println(err)

1
go.mod
View File

@ -5,7 +5,6 @@ go 1.13
require ( require (
github.com/fsnotify/fsnotify v1.4.7 github.com/fsnotify/fsnotify v1.4.7
github.com/go-sql-driver/mysql v1.5.0 github.com/go-sql-driver/mysql v1.5.0
github.com/mitchellh/gox v1.0.1 // indirect
github.com/robfig/cron/v3 v3.0.0 github.com/robfig/cron/v3 v3.0.0
github.com/spf13/viper v1.6.2 github.com/spf13/viper v1.6.2
github.com/tidwall/gjson v1.6.0 github.com/tidwall/gjson v1.6.0