You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
473 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package LogUtil
import (
"log"
"os"
)
/**
功能:记录错误信息
作者:黄海
时间2020-03-24
*/
func Error(code string, msg string) {
//设置手工日志的办法
logFile, err := os.OpenFile("./dsBaseRpc.log", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
defer logFile.Close()
if err != nil {
log.Fatalln("open file error !")
}
// 创建一个日志对象
debugLog := log.New(logFile, "[Error]", log.LstdFlags)
debugLog.Println(code, "\t", msg)
}