sangwq 2 jaren geleden
bovenliggende
commit
64c7ef574e
2 gewijzigde bestanden met toevoegingen van 59 en 16 verwijderingen
  1. 42 15
      Venus/Venus_RT/Config/LogDefine.json
  2. 17 1
      Venus/Venus_RT/Config/VenusPreProcess.py

+ 42 - 15
Venus/Venus_RT/Config/LogDefine.json

@@ -1,17 +1,8 @@
 [
   {
-    "Id": 9,
-    "Level": "Error",
-    "LogEnum": "WcfOpenError",
-    "GlobalDescription_zh": "WCF服务{0}未能打开,原因:{1}",
-    "GlobalDescription_en": "WCF Service{0}can not open,reason:{1} ",
-    "Module": "System",
-    "Note": "wcf未能打开"
-  },
-  {
     "Id": 1,
     "Level": "Info",
-    "LogEnum": "LogOffInfo",
+    "LogEnum": "EV_LOGOFF_INFO",
     "GlobalDescription_zh": "用户'{0}'注销登录",
     "GlobalDescription_en": "",
     "Module": "System",
@@ -20,7 +11,7 @@
   {
     "Id": 2,
     "Level": "Info",
-    "LogEnum": "LogOutInfo",
+    "LogEnum": "EV_LOGOUT_INFO",
     "GlobalDescription_zh": "强制用户{0}登出,原因:{1}",
     "GlobalDescription_en": "Force user {0} logout system,reason:{1}。",
     "Module": "System",
@@ -29,7 +20,7 @@
   {
     "Id": 3,
     "Level": "Error",
-    "LogEnum": "LogOffError",
+    "LogEnum": "ERR_LOGOFF_ERROR",
     "GlobalDescription_zh": "注销用户{0}发生异常",
     "GlobalDescription_en": "",
     "Module": "System",
@@ -38,7 +29,7 @@
   {
     "Id": 4,
     "Level": "Error",
-    "LogEnum": "UpdatePWError",
+    "LogEnum": "ERR_UPDATE_PW_ERROR",
     "GlobalDescription_zh": "修改账号{0}的密码失败",
     "GlobalDescription_en": "",
     "Module": "System",
@@ -47,7 +38,7 @@
   {
     "Id": 5,
     "Level": "Error",
-    "LogEnum": "DeleteUserError",
+    "LogEnum": "ERR_DELETE_USER_ERROR",
     "GlobalDescription_zh": "删除账号{0}发生异常",
     "GlobalDescription_en": "",
     "Module": "System",
@@ -56,10 +47,46 @@
   {
     "Id": 6,
     "Level": "Error",
-    "LogEnum": "UpdateUserError",
+    "LogEnum": "ERR_UPDATE_USER_ERROR",
     "GlobalDescription_zh": "更新账号{0}资料发生异常",
     "GlobalDescription_en": "",
     "Module": "System",
     "Note": ""
+  },
+  {
+    "Id": 9,
+    "Level": "Error",
+    "LogEnum": "ERR_WCF_OPEN_ERROR",
+    "GlobalDescription_zh": "WCF服务{0}未能打开,原因:{1}",
+    "GlobalDescription_en": "WCF Service{0}can not open,reason:{1} ",
+    "Module": "System",
+    "Note": "wcf未能打开"
+  },
+  {
+    "Id": 10,
+    "Level": "Info",
+    "LogEnum": "EV_ROUTINE_NOTIFY",
+    "GlobalDescription_zh": "[{0}] routine, {1}",
+    "GlobalDescription_en": "[{0}] routine, {1}",
+    "Module": "System",
+    "Note": "Routine Notify"
+  },
+  {
+    "Id": 11,
+    "Level": "Warning",
+    "LogEnum": "WARN_DEFAULT_WARN",
+    "GlobalDescription_zh": "{0}。",
+    "GlobalDescription_en": "{0}.",
+    "Module": "System",
+    "Note": "Default Warning"
+  },
+  {
+    "Id": 12,
+    "Level": "Alarm",
+    "LogEnum": "ERR_ROUTINE_FAILED",
+    "GlobalDescription_zh": "[{0}] routine failed, {1}",
+    "GlobalDescription_en": "[{0}] routine failed, {1}",
+    "Module": "System",
+    "Note": "Routine Failed"
   }
 ]

+ 17 - 1
Venus/Venus_RT/Config/VenusPreProcess.py

@@ -1,5 +1,7 @@
+from base64 import decode
 import os
 import xml.etree.cElementTree as ET
+import json
 
 def ProcessEventDefine():
     tree = ET.parse(r"..\..\Config\EventDefine.xml")
@@ -15,8 +17,22 @@ def ProcessEventDefine():
     with open(r"..\..\..\Venus_Core\EventDefine.cs", "w+") as fs:
         fs.writelines(EventContent)
 
+def ProcessEventLog():
+
+    EventContent = ['namespace Aitex.Core.RT.Log{\n\tpublic enum eEvent{\n\n']
+    with open(r"..\..\Config\LogDefine.json", encoding='utf-8') as file:
+        nodes = json.load(file)
+        for node in nodes:
+            ID = node['Id']
+            Enum = node['LogEnum']
+            EventContent.append(f'\t\t{Enum} = {ID},\n')
+
+        EventContent.append("\t}\n}\n")
+        with open(r"..\..\..\Venus_Core\EventDefine.cs", "w+") as fs:
+            fs.writelines(EventContent)
+
 def main():
-    ProcessEventDefine()
+    ProcessEventLog()
 
 
 if __name__ == "__main__":