RegisterLogger 注册日志
(log string)
| 108 | |
| 109 | // RegisterLogger 注册日志 |
| 110 | func RegisterLogger(log string) { |
| 111 | |
| 112 | logs.SetLogFuncCall(true) |
| 113 | logs.SetLogger("console") |
| 114 | logs.EnableFuncCallDepth(true) |
| 115 | logs.Async() |
| 116 | |
| 117 | logPath := filepath.Join(log, "log.log") |
| 118 | |
| 119 | if _, err := os.Stat(logPath); os.IsNotExist(err) { |
| 120 | |
| 121 | os.MkdirAll(log, 0777) |
| 122 | |
| 123 | if f, err := os.Create(logPath); err == nil { |
| 124 | f.Close() |
| 125 | config := make(map[string]interface{}, 1) |
| 126 | |
| 127 | config["filename"] = logPath |
| 128 | |
| 129 | b, _ := json.Marshal(config) |
| 130 | |
| 131 | beego.SetLogger("file", string(b)) |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | beego.SetLogFuncCall(true) |
| 136 | beego.BeeLogger.Async() |
| 137 | } |
| 138 | |
| 139 | // RunCommand 注册orm命令行工具 |
| 140 | func RegisterCommand() { |
no test coverage detected