lcl 7 bulan lalu
induk
melakukan
7fe47e530e
4 mengubah file dengan 56 tambahan dan 36 penghapusan
  1. TEMPAT SAMPAH
      .DS_Store
  2. 20 0
      .vscode/launch.json
  3. 11 11
      AppStart/SLS/LogHelper.cs
  4. 25 25
      AppStart/SLS/SLS.cs

TEMPAT SAMPAH
.DS_Store


+ 20 - 0
.vscode/launch.json

@@ -23,6 +23,26 @@
                 "/Views": "${workspaceFolder}/Views"
             }
         },
+        {
+            "name": ".NET Core Launch (pro)",
+            "type": "coreclr",
+            "request": "launch",
+            "preLaunchTask": "build",
+            "program": "${workspaceFolder}/bin/Debug/netcoreapp3.0/MySystem.dll",
+            "args": [],
+            "cwd": "${workspaceFolder}",
+            "stopAtEntry": false,
+            "serverReadyAction": {
+                "action": "openExternally",
+                "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"
+            },
+            "env": {
+                "ASPNETCORE_ENVIRONMENT": "Production"
+            },
+            "sourceFileMap": {
+                "/Views": "${workspaceFolder}/Views"
+            }
+        },
         {
             "name": ".NET Core Attach",
             "type": "coreclr",

+ 11 - 11
AppStart/SLS/LogHelper.cs

@@ -40,7 +40,7 @@ public class LogHelper
                 }
                 catch (Exception ex)
                 {
-                    LogHelper.Instance.WriteLog(DateTime.Now.ToString() + "\n" + content + "\n" + ex, "SLS日志异常");
+                    function.WriteLog(DateTime.Now.ToString() + "\n" + content + "\n" + ex, "SLS日志异常");
                 }
             }
             else
@@ -55,17 +55,17 @@ public class LogHelper
         JsonData JsonObj = JsonMapper.ToObject(content);
         string Topic = JsonObj["Topic"].ToString();
         string Cont = JsonObj["Content"].ToString();
-        string Tags = JsonObj["Tags"].ToString();
+        // string Tags = JsonObj["Tags"].ToString();
         Dictionary<string, string> otherTags = new Dictionary<string, string>();
-        if(!string.IsNullOrEmpty(Tags))
-        {
-            string[] TagList = Tags.Split(',');
-            JsonData contObj = JsonMapper.ToObject(Cont);
-            foreach(string Tag in TagList)
-            {
-                otherTags.Add(key: Tag, contObj[Tag].ToString());
-            }
-        }
+        // if(!string.IsNullOrEmpty(Tags))
+        // {
+        //     string[] TagList = Tags.Split(',');
+        //     JsonData contObj = JsonMapper.ToObject(Cont);
+        //     foreach(string Tag in TagList)
+        //     {
+        //         otherTags.Add(key: Tag, contObj[Tag].ToString());
+        //     }
+        // }
         SLS.WriteLog(DateTime.Now, Topic, Cont, otherTags);
     }
 }

+ 25 - 25
AppStart/SLS/SLS.cs

@@ -25,33 +25,33 @@ namespace MySystem
         //创建日志服务Client。
         private static ILogServiceClient client = BuildSimpleClient();
 
-        static async Task Main()
-        {
-            //创建Project。
-            var proRes = await client.CreateProjectAsync(project, "des");
-            check(proRes);
-            Console.WriteLine("Create project success");
-            Thread.Sleep(120 * 1000);
+        // static async Task Main()
+        // {
+        //     //创建Project。
+        //     var proRes = await client.CreateProjectAsync(project, "des");
+        //     check(proRes);
+        //     Console.WriteLine("Create project success");
+        //     Thread.Sleep(120 * 1000);
             
-            //创建Logstore。
-            var storeRes = await client.CreateLogStoreAsync(logstore, 3, 2);
-            check(storeRes);
-            Console.WriteLine("Create logstore success");
-            Thread.Sleep(10 * 1000);
+        //     //创建Logstore。
+        //     var storeRes = await client.CreateLogStoreAsync(logstore, 3, 2);
+        //     check(storeRes);
+        //     Console.WriteLine("Create logstore success");
+        //     Thread.Sleep(10 * 1000);
             
-            //为Logstore创建索引。
-            var indRes = await client.CreateIndexAsync(logstore, new IndexLineInfo(new[] {' ', ','}));
-            check(indRes);
-            Console.WriteLine("Create Index success");
-            Thread.Sleep(60 * 1000);
-
-            //向Logstore写入数据。
-            // await PostLogs();
-            Console.WriteLine("Post logs success");
-            Thread.Sleep(3000);
-            //查询日志。
-            await GetLogs();
-        }
+        //     //为Logstore创建索引。
+        //     var indRes = await client.CreateIndexAsync(logstore, new IndexLineInfo(new[] {' ', ','}));
+        //     check(indRes);
+        //     Console.WriteLine("Create Index success");
+        //     Thread.Sleep(60 * 1000);
+
+        //     //向Logstore写入数据。
+        //     // await PostLogs();
+        //     Console.WriteLine("Post logs success");
+        //     Thread.Sleep(3000);
+        //     //查询日志。
+        //     await GetLogs();
+        // }
 
         public static async void CreateProject(string name, string detail)
         {