소스 검색

调整日志格式

lcl 7 달 전
부모
커밋
4774db4907
4개의 변경된 파일11개의 추가작업 그리고 4개의 파일을 삭제
  1. BIN
      .DS_Store
  2. 9 2
      Controllers/HomeController.cs
  3. 1 1
      Startup.cs
  4. 1 1
      Views/Home/LogSelect.cshtml

BIN
.DS_Store


+ 9 - 2
Controllers/HomeController.cs

@@ -73,8 +73,9 @@ namespace MySystem.Controllers
             return View();
         }
 
-        public async Task<IList<IDictionary<string, string>>> LogSelectResult(string condi)
+        public async Task<string> LogSelectResult(string condi)
         {
+            string result = "";
             string[] condiList = condi.Split('|');
             string logstore = "connect-log";
             string topic = condiList[0];
@@ -85,7 +86,13 @@ namespace MySystem.Controllers
                 logstore = "spserver";
             }
             IList<IDictionary<string, string>> logs = await SLS.GetLogs(logstore, topic, "* and content: " + keyword, DateTimeOffset.Now.AddMonths(-int.Parse(month)));
-            return logs;
+            foreach(IDictionary<string, string> log in logs)
+            {
+                result += log["__tag__:datetime"] + "\n";
+                result += log["content"] + "\n";
+                result += "\n--------------------------------------------------------------------------------------------------\n\n";
+            }
+            return result;
         }
     }
 }

+ 1 - 1
Startup.cs

@@ -141,7 +141,7 @@ namespace MySystem
                     pattern: "{controller=Home}/{action=Index}/{Id?}");
             });
 
-            LogHelper.Instance.Start();
+            // LogHelper.Instance.Start();
 
             // SetFeeService.Instance.Start();
         }

+ 1 - 1
Views/Home/LogSelect.cshtml

@@ -4,7 +4,7 @@
     <meta charset="UTF-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Document</title>
+    <title>日志查询</title>
 </head>
 <body>
     <div>