瀏覽代碼

修复BUG

Minho 8 年之前
父節點
當前提交
4459f76a17
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      commands/command.go

+ 8 - 2
commands/command.go

@@ -20,6 +20,7 @@ import (
 	"github.com/lifei6671/godoc/models"
 	"github.com/lifei6671/godoc/utils"
 	"log"
+	"encoding/json"
 )
 
 var (
@@ -90,11 +91,16 @@ func RegisterLogger(log string) {
 	if _, err := os.Stat(logPath); os.IsNotExist(err) {
 
 		os.MkdirAll(log, 0777)
-		logPath = strings.Replace(logPath,"\\","/","")
 
 		if f, err := os.Create(logPath); err == nil {
 			f.Close()
-			beego.SetLogger("file", fmt.Sprintf(`{"filename":"%s"}`, logPath))
+			config := make(map[string]interface{},1)
+
+			config["filename"] = logPath
+
+			b,_ := json.Marshal(config)
+
+			beego.SetLogger("file", string(b))
 		}
 	}