mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-04-05 20:17:53 +08:00
修复BUG
This commit is contained in:
parent
b5324092e1
commit
4459f76a17
@ -20,6 +20,7 @@ import (
|
|||||||
"github.com/lifei6671/godoc/models"
|
"github.com/lifei6671/godoc/models"
|
||||||
"github.com/lifei6671/godoc/utils"
|
"github.com/lifei6671/godoc/utils"
|
||||||
"log"
|
"log"
|
||||||
|
"encoding/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -90,11 +91,16 @@ func RegisterLogger(log string) {
|
|||||||
if _, err := os.Stat(logPath); os.IsNotExist(err) {
|
if _, err := os.Stat(logPath); os.IsNotExist(err) {
|
||||||
|
|
||||||
os.MkdirAll(log, 0777)
|
os.MkdirAll(log, 0777)
|
||||||
logPath = strings.Replace(logPath,"\\","/","")
|
|
||||||
|
|
||||||
if f, err := os.Create(logPath); err == nil {
|
if f, err := os.Create(logPath); err == nil {
|
||||||
f.Close()
|
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user