From 508a1fc8f2d5cde4116371d2adec012f57aef807 Mon Sep 17 00:00:00 2001
From: haozhifeng <haozhifeng>
Date: 星期四, 12 八月 2021 10:21:34 +0800
Subject: [PATCH] ruleserver 日志
---
logc.go | 5 +++++
ruleServerLog.go | 29 +++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/logc.go b/logc.go
index b5fd920..dea2af5 100644
--- a/logc.go
+++ b/logc.go
@@ -108,6 +108,10 @@
deliverLog(log, timeout)
}
+func SaveRuleServerLog(ruleServerPushLog RuleServerPushLog, timeout time.Duration) {
+ deliverLog(&ruleServerPushLog, timeout)
+}
+
func deliverLog(l LogPrinter, timeout time.Duration) {
select {
case logCh <- l:
@@ -162,6 +166,7 @@
const (
OperationLogTopic = "operationLogSaveTopic"
ScheduleLogTopic = "scheduleLogSaveTopic"
+ RuleServerLogTopic = "ruleServerLogSaveTopic"
)
func saveLoop(logCallback LogReportCallback, wg *sync.WaitGroup, done chan struct{}) {
diff --git a/ruleServerLog.go b/ruleServerLog.go
new file mode 100644
index 0000000..3949b67
--- /dev/null
+++ b/ruleServerLog.go
@@ -0,0 +1,29 @@
+package logc
+
+import "encoding/json"
+
+type RuleServerLog struct {
+ ID string `gorm:"column:id;primaryKey;unique;autoIncrement" json:"id"` // 涓婚敭id
+ Name string `gorm:"column:name" json:"name"`
+ State string `gorm:"column:state" json:"state"`
+ TotalSuccess int `gorm:"column:totalSuccess" json:"totalSuccess"`
+ TotalFailure int `gorm:"column:totalFailure" json:"totalFailure"`
+ TotalCached string `gorm:"column:totalCached" json:"totalCached"`
+ LastSendDate string `gorm:"column:lastSendDate" json:"lastSendDate"`
+ CreateDate int64 `gorm:"column:createDate" json:"createDate"`
+}
+
+type RuleServerPushLog struct {
+ ID string // 涓婚敭id
+ TaskName string // 浠诲姟鍚嶇О
+ Type int // 娑堟伅绫诲瀷: 0 鏇存柊鐘舵�� 1 鎴愬姛+1 2 澶辫触+1 3 缂撳瓨涓婃姤
+ Info string // 璇︽儏
+}
+
+func (l *RuleServerPushLog) Marshal() ([]byte, error) {
+ return json.Marshal(l)
+}
+
+func (l *RuleServerPushLog) Topic() string {
+ return RuleServerLogTopic
+}
--
Gitblit v1.8.0