From 7f0c64fd8ac293aa0f88873849026cbb4855e92b Mon Sep 17 00:00:00 2001 From: yuguojian <18126816215> Date: Tue, 15 Jul 2025 15:26:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=8F=82=E6=95=B0=E8=BD=AC?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- log/elasticsearch_map.json | 75 -------------------------------------- log/log.go | 12 ++---- 2 files changed, 4 insertions(+), 83 deletions(-) delete mode 100644 log/elasticsearch_map.json diff --git a/log/elasticsearch_map.json b/log/elasticsearch_map.json deleted file mode 100644 index 7b3ec9c..0000000 --- a/log/elasticsearch_map.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "settings": { - "index": { - "mapping": { - "source": { - "mode": "synthetic" - } - } - } - }, - "mappings": { - "properties": { - "caller": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword" - } - } - }, - "created_at": { - "type": "date", - "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis||epoch_second" - }, - "level": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword" - } - } - }, - "log": { - "properties": { - "at": { - "type": "date", - "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis||epoch_second" - }, - "log_type": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword" - } - } - }, - "param": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword" - } - } - }, - "result": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword" - } - } - }, - "title": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword" - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/log/log.go b/log/log.go index 1e182b1..22ac1a5 100644 --- a/log/log.go +++ b/log/log.go @@ -36,8 +36,8 @@ const ( ) type Operator struct { - ID int // 系统ID设置0 - OperatorType OperatorType + ID int // 系统ID设置0 + OperatorType OperatorType `json:"operator_type"` } type LogInfo struct { @@ -91,7 +91,7 @@ func ZapFatal(logger *zap.Logger, log *LogInfo) { func HandleLog(log *LogInfo) { // 处理 Param - //log.Param = processValue(log.Param) + log.Param = processValue(log.Param) // 处理 Result log.Result = processValue(log.Result) } @@ -150,9 +150,5 @@ func processValue(value interface{}) interface{} { if value == nil { return "" } - if _, ok := value.(error); ok { - return fmt.Sprintf("%+v", value) - } else { - return value - } + return fmt.Sprintf("%+v", value) }