use logrus to project default log tools
This commit is contained in:
@@ -3,7 +3,6 @@ package common
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
)
|
||||
@@ -25,86 +24,6 @@ import (
|
||||
// return res
|
||||
//}
|
||||
|
||||
//func LogError(logMsg interface{}) {
|
||||
//
|
||||
// logFmt(fmt.Sprintln(logMsg), 2, LOG_ERROR)
|
||||
//}
|
||||
//func LogWarn(logMsg interface{}) {
|
||||
//
|
||||
// logFmt(fmt.Sprintln(logMsg), 2, LOG_WARN)
|
||||
//}
|
||||
//func LogInfo(logMsg ...interface{}) {
|
||||
//
|
||||
// logFmt(fmt.Sprintln(logMsg), 2, LOG_INFO)
|
||||
//}
|
||||
//
|
||||
//func LogFmt(logMsg interface{}, loglevel ...LOG_MODE) {
|
||||
//
|
||||
// logFmt(logMsg, 2, loglevel...)
|
||||
//}
|
||||
//
|
||||
////日志打印以及存储到文件
|
||||
//func logFmt(logMsg interface{}, printLevel int, loglevel ...LOG_MODE) {
|
||||
//
|
||||
// if Config.GetInt("logLevel") == int(LOG_NIL) {
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// lev := LOG_INFO
|
||||
// if len(loglevel) != 0 {
|
||||
// lev = loglevel[0]
|
||||
// }
|
||||
// gofile := ""
|
||||
//
|
||||
// if Config.GetInt("debug") != 0 && printLevel != 0 {
|
||||
// _, file, line, ok := runtime.Caller(printLevel)
|
||||
// if ok {
|
||||
// gofile = " " + file + ":" + ObjToStr(line)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// logStr := ""
|
||||
//
|
||||
// if lev == LOG_INFO {
|
||||
// logStr = "info:"
|
||||
// }
|
||||
// if printLevel == 0 {
|
||||
// logStr = "connect:"
|
||||
// }
|
||||
//
|
||||
// if lev == LOG_WARN {
|
||||
// logStr = "warn:"
|
||||
// }
|
||||
//
|
||||
// if lev == LOG_ERROR {
|
||||
// logStr = "error:"
|
||||
// }
|
||||
//
|
||||
// logStr = fmt.Sprintln(time.Now().Format("2006/01/02 15:04:05"), logStr, logMsg, gofile)
|
||||
// //打印日志
|
||||
// fmt.Print(logStr)
|
||||
// //不需要存储到文件
|
||||
// if Config.GetString("logFile") == "" {
|
||||
// return
|
||||
// }
|
||||
// //存储到文件
|
||||
// logFilePath := time.Now().Format(Config.GetString("logFile"))
|
||||
//
|
||||
// os.MkdirAll(filepath.Dir(logFilePath), os.ModeAppend)
|
||||
// //os.Create(logFilePath)
|
||||
// f, err := os.OpenFile(logFilePath, os.O_APPEND|os.O_CREATE, 0644)
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
// f.Write([]byte(logStr))
|
||||
// f.Close()
|
||||
//
|
||||
//}
|
||||
//日志打印以及存储到文件
|
||||
func LogFmt(logMsg interface{}, printLevel int, loglevel ...LOG_MODE) {
|
||||
fmt.Println(logMsg)
|
||||
}
|
||||
|
||||
//字符串首字符大写
|
||||
func StrFirstToUpper(str string) string {
|
||||
if len(str) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user