From d5f4c1b1cedece02a01ffe107229ad924a1c6fb4 Mon Sep 17 00:00:00 2001
From: chenshijun <csj_sky@126.com>
Date: 星期三, 13 一月 2021 19:29:06 +0800
Subject: [PATCH] 修改日志格式化的代码
---
logc.go | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/logc.go b/logc.go
index 7b21d31..99ce25d 100644
--- a/logc.go
+++ b/logc.go
@@ -55,22 +55,21 @@
go saveLoop()
}
-func Save(level int, logType int,template string, v ...interface{}) {
- cache(level, logType, "", "", template, v)
+func Save(level int, logType int, v ...interface{}) {
+ cache(level, logType, "", "", v)
}
-func SaveManual(level int, logType int, userID string, userName string, template string, v ...interface{}) {
- cache(level, logType, userID, userName, template, v)
+func SaveManual(level int, logType int, userID string, userName string, v ...interface{}) {
+ cache(level, logType, userID, userName, v)
}
-func cache(level int, logType int, userID string, userName string, template string, fmtArgs []interface{}) {
+func cache(level int, logType int, userID string, userName string, fmtArgs []interface{}) {
// Format with Sprint, Sprintf, or neither.
- msg := template
- if msg == "" && len(fmtArgs) > 0 {
+ msg := ""
+ if len(fmtArgs) > 0 {
msg = fmt.Sprint(fmtArgs...)
- } else if msg != "" && len(fmtArgs) > 0 {
- msg = fmt.Sprintf(template, fmtArgs...)
}
+ fmt.Println(msg)
log := LogInfo {
ID: uuid.NewV4().String(),
--
Gitblit v1.8.0