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) }