|
|
|
@ -2,6 +2,7 @@ package LogUtil
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"dsBaseRpc/Utils/CommonUtil"
|
|
|
|
|
"dsBaseRpc/Utils/ConfigUtil"
|
|
|
|
|
"fmt"
|
|
|
|
|
"log"
|
|
|
|
|
"os"
|
|
|
|
@ -14,13 +15,13 @@ import (
|
|
|
|
|
*/
|
|
|
|
|
func Error(code string, msg string) {
|
|
|
|
|
//判断是不是单元测试,如果是的话,那么配置文件的路径需要加上一个.
|
|
|
|
|
var logPath = "/usr/local/dsMin/dsBaseRpc/Logs"
|
|
|
|
|
var logPath = ConfigUtil.DistributeRemotePath+"Logs"
|
|
|
|
|
if !CommonUtil.Exists(logPath) {
|
|
|
|
|
//创建
|
|
|
|
|
os.MkdirAll(logPath, os.ModePerm)
|
|
|
|
|
}
|
|
|
|
|
//设置手工日志的办法
|
|
|
|
|
logFile, err := os.OpenFile(logPath+"/dsBaseRpc.log", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
|
|
|
|
|
logFile, err := os.OpenFile(logPath+"/dsBaseRpcManual.log", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
|
|
|
|
|
defer logFile.Close()
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println("open file error !")
|
|
|
|
|