{"id":14578,"date":"2025-04-18T21:18:15","date_gmt":"2025-04-18T13:18:15","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/14578.html"},"modified":"2025-04-18T21:18:15","modified_gmt":"2025-04-18T13:18:15","slug":"%e3%80%90c%e3%80%91-%e9%ab%98%e6%95%88%e6%97%a5%e5%bf%97%e6%89%93%e5%8d%b0-logger%e4%bb%a3%e7%a0%81%e5%ae%9e%e7%8e%b0%e3%80%90%e4%b8%b2%e5%8f%a3%e9%80%9a%e4%bf%a1%e6%97%a5%e5%bf%97%ef%bc%8c%e6%9c%8d","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/14578.html","title":{"rendered":"\u3010C#\u3011 \u9ad8\u6548\u65e5\u5fd7\u6253\u5370 Logger\u4ee3\u7801\u5b9e\u73b0\u3010\u4e32\u53e3\u901a\u4fe1\u65e5\u5fd7\uff0c\u670d\u52a1\u5668\u65e5\u5fd7\uff0c\u5f02\u5e38\u8bb0\u5f55\uff0c\u7cfb\u7edf\u72b6\u6001\u76d1\u63a7\uff0c\u7a0b\u5e8f\u5d29\u6e83 \u65e5\u5fd7\u4e5f\u4e0d\u4f1a\u4e22\u5931\u3011"},"content":{"rendered":"<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>1 \u95ee\u9898\u5f15\u5165 \u53ca \u5206\u6790<\/li>\n<li>1.1 \u7279\u70b9<\/li>\n<li>2 \u9ad8\u6548\u65e5\u5fd7\u5199\u5165 \uff08\u591a\u4e2a\u7ebf\u7a0b\u540c\u65f6\u8c03\u7528\uff09<\/li>\n<li>3 .\u4ee3\u7801\u4f18\u5316\uff08\u907f\u514dlock\u5bf9\u4e3b\u7ebf\u7a0b\u7684\u5f71\u54cd\uff09<\/li>\n<li>\n<ul>\n<li>3.1 \u4f18\u5316\u540e\u7684\u6e90\u7801<\/li>\n<li>3.2 \u5316\u540e\u4ee3\u7801\u7684\u4f18\u52bf<\/li>\n<li>3.3 \u65e5\u5fd7\u8c03\u7528\u793a\u4f8b<\/li>\n<li>3.4 \u5982\u679c\u4e0d\u8c03\u7528 StopLogger() \u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f<\/li>\n<li>3.5 \u5982\u4f55\u786e\u4fdd StopLogger() \u88ab\u8c03\u7528<\/li>\n<\/ul>\n<\/li>\n<li>4 AutoFlush = true \u548c Flush() \u9002\u7528\u573a\u666f<\/li>\n<li>5 \u964d\u4f4e\u78c1\u76d8\u8d1f\u62c5\uff0c\u63d0\u9ad8\u5199\u5165\u6027\u80fd<\/li>\n<li>\n<ul>\n<li>5.1 \u5b8c\u6574\u4ee3\u7801<\/li>\n<li>5.2 \u591a\u7ebf\u7a0b\u65e5\u5fd7\u5199\u5165\u793a\u4f8b<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>1 \u95ee\u9898\u5f15\u5165 \u53ca \u5206\u6790<\/h2>\n<p>\u7a0b\u5e8f\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2d\uff0c\u5076\u53d1\u6027\u7684\u51fa\u73b0\u6545\u969c\uff0c\u65f6\u6709\u65f6\u65e0\u3002<\/p>\n<p>\u4e3a\u4e86\u5bf9\u8fd0\u884c\u8fc7\u7a0b\u4ee5\u53ca\u7a0b\u5e8f\u6545\u969c\u7684\u8ddf\u8e2a\uff0c\u6211\u4eec\u5bf9\u4e32\u53e3\u6570\u636e\u76d1\u63a7\u4e8b\u4ef6\u7684\u548cTCP\u76d1\u63a7\u4e8b\u4ef6\u4e2d\u7684\u6570\u636e\u53ca\u72b6\u6001\u90fd\u5199\u5165\u65e5\u5fd7\u8bb0\u5f55\u3002<\/p>\n<p>\u4e0b\u9762\u4e32\u53e3\u4e8b\u4ef6\u548ctcp\u4e8b\u4ef6TcpClientHelper.getMsgInvoked += TcpClientHelper_getMsgInvoked;\u548c SP.ReceivedBytesEventHandler += SP_ReceivedBytesEventHandler; \uff0c\u5bf9\u4e8e\u4e8b\u4ef6\u53ef\u4ee5\u7406\u89e3\u4e3a\u7ebf\u7a0b\uff0c\u8fd9\u91cc\u540c\u65f6\u542f\u52a8\u4e24\u4e2a\u4e8b\u4ef6\uff0c\u5c31\u76f8\u5f53\u4e8e\u5f00\u4e86\u4e24\u4e2a\u7ebf\u7a0b\u3002<\/p>\n<p>\u90a3\u4e48\u65e2\u7136\u90a3\u662f \u5bf9\u8fd0\u884c\u8fc7\u7a0b\u4ee5\u53ca\u7a0b\u5e8f\u6545\u969c\u7684\u8ddf\u8e2a\uff0c\u6211\u4eec\u7684\u65e5\u5fd7\u9700\u8981\u5177\u5907\u4ee5\u4e0b\u7279\u70b9\uff1a<\/p>\n<h2>1.1 \u7279\u70b9<\/h2>\n<ul>\n<li>\n<p>1 .\u4f7f\u7528 StreamWriter \u5e76\u5f00\u542f AutoFlush = true\uff1a\u907f\u514d\u9891\u7e41\u6253\u5f00\/\u5173\u95ed\u6587\u4ef6\uff0c\u63d0\u9ad8\u5199\u5165\u6548\u7387\u3002<\/p>\n<\/li>\n<li>\n<p>2.\u4f7f\u7528 File.AppendText()\uff1a\u9ad8\u6548\u5730\u8ffd\u52a0\u5199\u5165\uff0c\u4e0d\u9700\u8981\u6bcf\u6b21\u6253\u5f00\u65b0\u6587\u4ef6\u3002<\/p>\n<\/li>\n<li>\n<p>3.\u591a\u4e2a\u7ebf\u7a0b\u540c\u65f6\u8c03\u7528\uff1a\u5728\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u4f18\u5316\u5199\u5165\u6027\u80fd\u3002<\/p>\n<\/li>\n<li>\n<p>4.\u65e5\u5fd7\u6309\u65e5\u671f\u5206\u7c7b\u5b58\u50a8\uff1a\u6bcf\u5929\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u65e5\u5fd7\u6587\u4ef6\uff0c\u907f\u514d\u5355\u4e2a\u6587\u4ef6\u8fc7\u5927\u5f71\u54cd\u6027\u80fd\u3002<\/p>\n<\/li>\n<li>\n<p>5.\u4e0d\u80fd\u80fd\u5f71\u54cd \u4e8b\u4ef6\u5904\u7406\u51fd\u6570\uff08\u4e3b\u7ebf\u7a0b\uff09\u7684\u6267\u884c\u6548\u7387\uff0c\u5c24\u5176\u662f\u5728\u9ad8\u9891\u8c03\u7528\u7684\u60c5\u51b5\u4e0b\u3002<\/p>\n<\/li>\n<li>\n<p>6 \u65e5\u5fd7\u4e0d\u4f1a\u4e22\u5931 \uff0c\u5373\u4f7f\u7a0b\u5e8f\u5d29\u6e83\uff0c\u65e5\u5fd7\u6570\u636e\u4e5f\u4f1a\u5199\u5165\u6587\u4ef6\u3002<\/p>\n<\/li>\n<\/ul>\n<h2>2 \u9ad8\u6548\u65e5\u5fd7\u5199\u5165 \uff08\u591a\u4e2a\u7ebf\u7a0b\u540c\u65f6\u8c03\u7528\uff09<\/h2>\n<p><span class=\"token keyword\">using<\/span> <span class=\"token namespace\">System<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">using<\/span> <span class=\"token namespace\">System<span class=\"token punctuation\">.<\/span>Collections<span class=\"token punctuation\">.<\/span>Generic<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">using<\/span> <span class=\"token namespace\">System<span class=\"token punctuation\">.<\/span>Linq<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">using<\/span> <span class=\"token namespace\">System<span class=\"token punctuation\">.<\/span>Text<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">using<\/span> <span class=\"token namespace\">System<span class=\"token punctuation\">.<\/span>Threading<span class=\"token punctuation\">.<\/span>Tasks<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">using<\/span> <span class=\"token namespace\">System<span class=\"token punctuation\">.<\/span>IO<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">namespace<\/span> <span class=\"token namespace\">Helper<\/span><br \/>\n<span class=\"token punctuation\">{<br \/>\n   <\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Logger<\/span><br \/>\n    <span class=\"token punctuation\">{<br \/>\n   <\/span><br \/>\n        <span class=\"token comment\">\/\/ **\u65e5\u5fd7\u6587\u4ef6\u5b58\u50a8\u76ee\u5f55**<\/span><br \/>\n        <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">readonly<\/span> <span class=\"token class-name\"><span class=\"token keyword\">string<\/span><\/span> LogDirectory <span class=\"token operator\">=<\/span> Path<span class=\"token punctuation\">.<\/span><span class=\"token function\">Combine<\/span><span class=\"token punctuation\">(<\/span>AppDomain<span class=\"token punctuation\">.<\/span>CurrentDomain<span class=\"token punctuation\">.<\/span>BaseDirectory<span class=\"token punctuation\">,<\/span> <span class=\"token string\">\\&#8221;Log\\&#8221;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ **\u5f53\u524d\u65e5\u5fd7\u6587\u4ef6\u7684\u8def\u5f84\uff08\u6309\u65e5\u671f\u547d\u540d\uff09**<\/span><br \/>\n        <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token class-name\"><span class=\"token keyword\">string<\/span><\/span> logFile <span class=\"token operator\">=<\/span> <span class=\"token function\">GetLogFilePath<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ **\u8bb0\u5f55\u4e0a\u4e00\u6b21\u5199\u65e5\u5fd7\u7684\u65e5\u671f**<\/span><br \/>\n        <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token class-name\">DateTime<\/span> lastLogDate <span class=\"token operator\">=<\/span> DateTime<span class=\"token punctuation\">.<\/span>Now<span class=\"token punctuation\">.<\/span>Date<span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ **\u7ebf\u7a0b\u9501\uff0c\u786e\u4fdd\u591a\u7ebf\u7a0b\u73af\u5883\u4e0b\u7684\u5b89\u5168\u5199\u5165**<\/span><br \/>\n        <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">readonly<\/span> <span class=\"token class-name\"><span class=\"token keyword\">object<\/span><\/span> lockObj <span class=\"token operator\">=<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token constructor-invocation class-name\"><span class=\"token keyword\">object<\/span><\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/\/ &lt;summary&gt;<\/span><br \/>\n        <span class=\"token comment\">\/\/\/ \u8ba1\u7b97\u5e76\u8fd4\u56de\u5f53\u524d\u65e5\u671f\u5bf9\u5e94\u7684\u65e5\u5fd7\u6587\u4ef6\u8def\u5f84<\/span><br \/>\n        <span class=\"token comment\">\/\/\/ &lt;\/summary&gt;<\/span><br \/>\n        <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token return-type class-name\"><span class=\"token keyword\">string<\/span><\/span> <span class=\"token function\">GetLogFilePath<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token punctuation\">{<br \/>\n   <\/span><br \/>\n            <span class=\"token keyword\">return<\/span> Path<span class=\"token punctuation\">.<\/span><span class=\"token function\">Combine<\/span><span class=\"token punctuation\">(<\/span>LogDirectory<span class=\"token punctuation\">,<\/span> DateTime<span class=\"token punctuation\">.<\/span>Now<span class=\"token punctuation\">.<\/span><span class=\"token function\">ToString<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">\\&#8221;yyyy-MM-dd\\&#8221;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">+<\/span> <span class=\"token string\">\\&#8221;.log\\&#8221;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/\/ &lt;summary&gt;<\/span><br \/>\n        <span class=\"token comment\">\/\/\/ \u5199\u65e5\u5fd7\uff08\u9ad8\u6548\u65b9\u5f0f\uff09<\/span><br \/>\n        <span class=\"token comment\">\/\/\/ &lt;\/summary&gt;<\/span><br \/>\n        <span class=\"token comment\">\/\/\/ &lt;param name=\\&#8221;message\\&#8221;&gt;\u8981\u8bb0\u5f55\u7684\u65e5\u5fd7\u4fe1\u606f&lt;\/param&gt;<\/span><br \/>\n        <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token return-type class-name\"><span class=\"token keyword\">void<\/span><\/span> <span class=\"token function\">WriteLog<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\"><span class=\"token keyword\">string<\/span><\/span> message<span class=\"token punctuation\">,<\/span><span class=\"token class-name\"><span class=\"token keyword\">bool<\/span><\/span> bNormal<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token punctuation\">{<br \/>\n   <\/span><br \/>\n            <span class=\"token keyword\">lock<\/span> <span class=\"token punctuation\">(<\/span>lockObj<span class=\"token punctuation\">)<\/span> <span class=\"token comment\">\/\/ \u786e\u4fdd\u591a\u7ebf\u7a0b\u5199\u5165\u5b89\u5168<\/span><br \/>\n            <span class=\"token punctuation\">{<br \/>\n   <\/span><br \/>\n                <span class=\"token comment\">\/\/ **\u68c0\u67e5\u65e5\u671f\u662f\u5426\u53d8\u66f4**<\/span><br \/>\n                <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>DateTime<span class=\"token punctuation\">.<\/span>Now<span class=\"token punctuation\">.<\/span>Date <span class=\"token operator\">&gt;<\/span> lastLogDate<span class=\"token punctuation\">)<\/span><br \/>\n                <span class=\"token punctuation\">{<br \/>\n   <\/span><br \/>\n                    lastLogDate <span class=\"token operator\">=<\/span> DateTime<span class=\"token punctuation\">.<\/span>Now<span class=\"token punctuation\">.<\/span>Date<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u66f4\u65b0\u65e5\u671f<\/span><br \/>\n                    logFile <span class=\"token operator\">=<\/span> <span class=\"token function\">GetLogFilePath<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u91cd\u65b0\u8ba1\u7b97\u65e5\u5fd7\u6587\u4ef6\u8def\u5f84<\/span><br \/>\n                <span class=\"token punctuation\">}<\/span><\/p>\n<p>                <span class=\"token keyword\">try<\/span><br \/>\n                <span class=\"token punctuation\">{<br \/>\n   <\/span><br \/>\n                    <span class=\"token comment\">\/\/ **\u786e\u4fdd\u65e5\u5fd7\u6587\u4ef6\u5939\u5b58\u5728**<\/span><br \/>\n                    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token operator\">!<\/span>Directory<span class=\"token punctuation\">.<\/span><span class=\"token function\">Exists<\/span><span class=\"token punctuation\">(<\/span>LogDirectory<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n                    <span class=\"token punctuation\">{<br \/>\n   <\/span><br \/>\n                        Directory<span class=\"token punctuation\">.<\/span><span class=\"token function\">CreateDirectory<\/span><span class=\"token punctuation\">(<\/span>LogDirectory<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n                    <span class=\"token punctuation\">}<\/span><\/p>\n<p>                    <span class=\"token comment\">\/\/ **\u4f7f\u7528 StreamWriter \u8fdb\u884c\u9ad8\u6548\u65e5\u5fd7\u5199\u5165**<\/span><br \/>\n                    <span class=\"token keyword\">using<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">StreamWriter<\/span> writer <span class=\"token operator\">=<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token constructor-invocation class-name\">StreamWriter<\/span><span class=\"token punctuation\">(<\/span>logFile<span class=\"token punctuation\">,<\/span> <span class=\"token boolean\">true<\/span><span class=\"token punctuation\">,<\/span> Encoding<span class=\"token punctuation\">.<\/span>UTF8<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n                    <span class=\"token punctuation\">{<br \/>\n   <\/span><br \/>\n                        writer<span class=\"token punctuation\">.<\/span>AutoFlush <span class=\"token operator\">=<\/span> <span class=\"token boolean\">true<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\">\/\/\u6570\u636e\u7acb\u5373\u5199\u5165\u78c1\u76d8\uff0c\u65e5\u5fd7\u4e0d\u4f1a\u4e22\u5931\uff0c\u5373\u4f7f\u7a0b\u5e8f\u5d29\u6e83\uff0c\u65e5\u5fd7\u6570\u636e\u4e5f\u4f1a\u5199\u5165\u6587\u4ef6\u3002<\/span><\/p>\n<p>                        <span class=\"token comment\">\/\/ **\u5199\u5165\u65e5\u5fd7\u5185\u5bb9**<\/span><br \/>\n                        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>bNormal<span class=\"token punctuation\">)<\/span><br \/>\n                            writer<span class=\"token punctuation\">.<\/span><span class=\"token function\">WriteLine<\/span><span class=\"token punctuation\">(<\/span><span class=\"token interpolation-string\"><span class=\"token string\">$\\&#8221;[<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<br \/>\n     <\/span><span class=\"token expression language-csharp\">DateTime<span class=\"token punctuation\">.<\/span>Now<\/span><span class=\"token format-string\"><span class=\"token punctuation\">:<\/span>yyyy-MM-dd HH:mm:ss<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">]&#8211;[NORMAL]: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<br \/>\n     <\/span><span class=\"token expression language-csharp\">message<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">\\&#8221;<\/span><\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n                        <span class=\"token keyword\">else<\/span><br \/>\n                            writer<span class=\"token punctuation\">.<\/span><span class=\"token function\">WriteLine<\/span><span class=\"token punctuation\">(<\/span><span class=\"token interpolation-string\"><span class=\"token string\">$\\&#8221;[<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<br \/>\n     <\/span><span class=\"token expression language-csharp\">DateTime<span class=\"token punctuation\">.<\/span>Now<\/span><span class=\"token format-string\"><span class=\"token punctuation\">:<\/span>yyyy-MM-dd HH:mm:ss<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">]&#8211;[ERROR]: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<br \/>\n     <\/span><span class=\"token expression language-csharp\">message<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">\\&#8221;<\/span><\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>                        <span class=\"token comment\">\/\/writer.Flush(); \/\/ \u624b\u52a8\u5237\u65b0\u7f13\u51b2\u533a\uff0c\u4ec5\u5728\u9700\u8981\u65f6\u8c03\u7528\uff0c\u51cf\u5c11\u78c1\u76d8\u9891\u7e41\u5237\u65b0\u8d1f\u62c5<\/span><br \/>\n                    <span class=\"token punctuation\">}<\/span><br \/>\n                <span class=\"token punctuation\">}<\/span><br \/>\n                <span class=\"token keyword\">catch<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Exception<\/span> ex<span class=\"token punctuation\">)<\/span><br \/>\n                <span class=\"token punctuation\">{<br \/>\n   <\/span><br \/>\n                    <span class=\"token comment\"> **\u5f02\u5e38\u5904\u7406\uff08\u9632\u6b62\u65e5\u5fd7\u5199\u5165\u5f02\u5e38\u5f71\u54cd\u7a0b\u5e8f\u8fd0\u884c\uff09**<\/span><br \/>\n                    <span class=\"token comment\">\/\/Console.WriteLine(\\&#8221;\u65e5\u5fd7\u5199\u5165\u5931\u8d25\uff1a\\&#8221; + ex.Message);<\/span><br \/>\n                <span class=\"token punctuation\">}<\/span><br \/>\n            <span class=\"token punctuation\">}<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8db3\u5b9e\u65f6\u6027\u548c\u591a\u7ebf\u7a0b\u5b89\u5168\u6027\u7684\u9700\u6c42\uff0c\u4f46 lock \u4f5c\u7528\u57df\u5185\u6253\u5f00\u6587\u4ef6\u5e76\u5199\u5165\u65e5\u5fd7\uff0c\u4f1a\u963b\u585e\u4e3b\u7ebf\u7a0b\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5f71\u54cd \u4e8b\u4ef6\u5904\u7406\u51fd\u6570 \u7684\u6267\u884c\u6548\u7387 \u5c24\u5176\u662f\u5728\u9ad8\u9891\u8c03\u7528\u7684\u60c5\u51b5\u4e0b\u3002<\/p>\n<p>\u6240\u4ee5\u8fdb\u4e00\u6b65\u6539\u8fdb<\/p>\n<h2>3 .\u4ee3\u7801\u4f18\u5316\uff08\u907f\u514dlock\u5bf9\u4e3b\u7ebf\u7a0b\u7684\u5f71\u54cd\uff09<\/h2>\n<p>\u4e0a\u9762\u7684\u4ee3\u7801\u5df2\u7ecf \u6ee1\u8db3\u5b9e\u65f6\u6027\u548c\u591a\u7ebf\u7a0b\u5b89\u5168\u6027\u7684\u9700\u6c42\uff0c\u4f46 lock \u4f5c\u7528\u57df\u5185\u6253\u5f00\u6587\u4ef6\u5e76\u5199\u5165\u65e5\u5fd7\uff0c\u4f1a\u963b\u585e\u4e3b\u7ebf\u7a0b\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5f71\u54cd \u4e8b\u4ef6\u5904\u7406\u51fd\u6570 \u7684\u6267\u884c\u6548\u7387 \u5c24\u5176\u662f\u5728\u9ad8\u9891\u8c03\u7528\u7684\u60c5\u51b5\u4e0b\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<ul>\n<li>\n<p>1.\u4f7f\u7528 ConcurrentQueue \u4f5c\u4e3a\u65e5\u5fd7\u7f13\u51b2\u533a\uff0c\u5e76\u5728\u5355\u72ec\u7684\u540e\u53f0\u7ebf\u7a0b\u4e2d\u5199\u5165\u65e5\u5fd7\uff0c\u51cf\u5c11\u5bf9\u4e3b\u7ebf\u7a0b\u7684\u5f71\u54cd\u3002<\/p>\n<\/li>\n<li>\n<p>2.\u4f7f\u7528 Task.Run()\u5f02\u6b65 \u6216 \u540e\u53f0\u7ebf\u7a0b \u5904\u7406\u65e5\u5fd7\u5199\u5165\uff0c\u51cf\u5c11 \u4e8b\u4ef6\u5904\u7406\u51fd\u6570 \u53d7\u5230\u7684\u5f71\u54cd\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>3.1 \u4f18\u5316\u540e\u7684\u6e90\u7801<\/h3>\n<p><span class=\"token keyword\">using<\/span> <span class=\"token namespace\">System<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">using<\/span> <span class=\"token namespace\">System<span class=\"token punctuation\">.<\/span>Collections<span class=\"token punctuation\">.<\/span>Concurrent<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">using<\/span> <span class=\"token namespace\">System<span class=\"token punctuation\">.<\/span>IO<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">using<\/span> <span class=\"token namespace\">System<span class=\"token punctuation\">.<\/span>Text<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">using<\/span> <span class=\"token namespace\">System<span class=\"token punctuation\">.<\/span>Threading<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">using<\/span> <span class=\"token namespace\">System<span class=\"token punctuation\">.<\/span>Threading<span class=\"token punctuation\">.<\/span>Tasks<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">namespace<\/span> <span class=\"token namespace\">Helper<\/span><br \/>\n<span class=\"token punctuation\">{<br \/>\n   <\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Logger<\/span><br \/>\n    <span class=\"token punctuation\">{<br \/>\n   <\/span><br \/>\n        <span class=\"token comment\">\/\/ **\u65e5\u5fd7\u5b58\u50a8\u76ee\u5f55**<\/span><br \/>\n        <span class=\"token keyword\">private<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">readonly<\/span> <span class=\"token class-name\"><span class=\"token keyword\">string<\/span><\/span> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb816\u6b21\uff0c\u70b9\u8d5e29\u6b21\uff0c\u6536\u85cf28\u6b21\u30021 .\u4f7f\u7528 StreamWriter \u5e76\u5f00\u542f AutoFlush = true\uff1a\u907f\u514d\u9891\u7e41\u6253\u5f00\/\u5173\u95ed\u6587\u4ef6\uff0c\u63d0\u9ad8\u5199\u5165\u6548\u7387\u3002\u6bcf\u6b21\u5199\u5165\u540e\uff0cStreamWriter \u81ea\u52a8\u5237\u65b0\uff0c\u4f46\u907f\u514d\u4e86 \u6bcf\u6b21\u4e8b\u4ef6\u8c03\u7528\u90fd\u91cd\u65b0\u521b\u5efa StreamWriter&#8220;\u30024.\u65e5\u5fd7\u6309\u65e5\u671f\u5206\u7c7b\u5b58\u50a8\uff1a\u6bcf\u5929\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u65e5\u5fd7\u6587\u4ef6\uff0c\u907f\u514d\u5355\u4e2a\u6587\u4ef6\u8fc7\u5927\u5f71\u54cd\u6027\u80fd\u3002\uff0c\u5bf9\u4e8e\u4e8b\u4ef6\u53ef\u4ee5\u7406\u89e3\u4e3a\u7ebf\u7a0b\uff0c\u8fd9\u91cc\u540c\u65f6\u542f\u52a8\u4e24\u4e2a\u4e8b\u4ef6\uff0c\u5c31\u76f8\u5f53\u4e8e\u5f00\u4e86\u4e24\u4e2a\u7ebf\u7a0b\u3002\u6216 \u540e\u53f0\u7ebf\u7a0b  \u5904\u7406\u65e5\u5fd7\u5199\u5165\uff0c\u51cf\u5c11 \u4e8b\u4ef6\u5904\u7406\u51fd\u6570 \u53d7\u5230\u7684\u5f71\u54cd\u3002\uff0c\u5e76\u5728\u5355\u72ec\u7684\u540e\u53f0\u7ebf\u7a0b\u4e2d\u5199\u5165\u65e5\u5fd7\uff0c\u51cf\u5c11\u5bf9\u4e3b\u7ebf\u7a0b\u7684\u5f71\u54cd\u3002_c# logger<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,920,923,43,921,922,919],"topic":[],"class_list":["post-14578","post","type-post","status-publish","format-standard","hentry","category-server","tag-c","tag-920","tag-923","tag-43","tag-921","tag-922","tag-919"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010C#\u3011 \u9ad8\u6548\u65e5\u5fd7\u6253\u5370 Logger\u4ee3\u7801\u5b9e\u73b0\u3010\u4e32\u53e3\u901a\u4fe1\u65e5\u5fd7\uff0c\u670d\u52a1\u5668\u65e5\u5fd7\uff0c\u5f02\u5e38\u8bb0\u5f55\uff0c\u7cfb\u7edf\u72b6\u6001\u76d1\u63a7\uff0c\u7a0b\u5e8f\u5d29\u6e83 \u65e5\u5fd7\u4e5f\u4e0d\u4f1a\u4e22\u5931\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/14578.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010C#\u3011 \u9ad8\u6548\u65e5\u5fd7\u6253\u5370 Logger\u4ee3\u7801\u5b9e\u73b0\u3010\u4e32\u53e3\u901a\u4fe1\u65e5\u5fd7\uff0c\u670d\u52a1\u5668\u65e5\u5fd7\uff0c\u5f02\u5e38\u8bb0\u5f55\uff0c\u7cfb\u7edf\u72b6\u6001\u76d1\u63a7\uff0c\u7a0b\u5e8f\u5d29\u6e83 \u65e5\u5fd7\u4e5f\u4e0d\u4f1a\u4e22\u5931\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb816\u6b21\uff0c\u70b9\u8d5e29\u6b21\uff0c\u6536\u85cf28\u6b21\u30021 .\u4f7f\u7528 StreamWriter \u5e76\u5f00\u542f AutoFlush = true\uff1a\u907f\u514d\u9891\u7e41\u6253\u5f00\/\u5173\u95ed\u6587\u4ef6\uff0c\u63d0\u9ad8\u5199\u5165\u6548\u7387\u3002\u6bcf\u6b21\u5199\u5165\u540e\uff0cStreamWriter \u81ea\u52a8\u5237\u65b0\uff0c\u4f46\u907f\u514d\u4e86 \u6bcf\u6b21\u4e8b\u4ef6\u8c03\u7528\u90fd\u91cd\u65b0\u521b\u5efa StreamWriter``\u30024.\u65e5\u5fd7\u6309\u65e5\u671f\u5206\u7c7b\u5b58\u50a8\uff1a\u6bcf\u5929\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u65e5\u5fd7\u6587\u4ef6\uff0c\u907f\u514d\u5355\u4e2a\u6587\u4ef6\u8fc7\u5927\u5f71\u54cd\u6027\u80fd\u3002\uff0c\u5bf9\u4e8e\u4e8b\u4ef6\u53ef\u4ee5\u7406\u89e3\u4e3a\u7ebf\u7a0b\uff0c\u8fd9\u91cc\u540c\u65f6\u542f\u52a8\u4e24\u4e2a\u4e8b\u4ef6\uff0c\u5c31\u76f8\u5f53\u4e8e\u5f00\u4e86\u4e24\u4e2a\u7ebf\u7a0b\u3002\u6216 \u540e\u53f0\u7ebf\u7a0b \u5904\u7406\u65e5\u5fd7\u5199\u5165\uff0c\u51cf\u5c11 \u4e8b\u4ef6\u5904\u7406\u51fd\u6570 \u53d7\u5230\u7684\u5f71\u54cd\u3002\uff0c\u5e76\u5728\u5355\u72ec\u7684\u540e\u53f0\u7ebf\u7a0b\u4e2d\u5199\u5165\u65e5\u5fd7\uff0c\u51cf\u5c11\u5bf9\u4e3b\u7ebf\u7a0b\u7684\u5f71\u54cd\u3002_c# logger\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/14578.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T13:18:15+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/14578.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/14578.html\",\"name\":\"\u3010C#\u3011 \u9ad8\u6548\u65e5\u5fd7\u6253\u5370 Logger\u4ee3\u7801\u5b9e\u73b0\u3010\u4e32\u53e3\u901a\u4fe1\u65e5\u5fd7\uff0c\u670d\u52a1\u5668\u65e5\u5fd7\uff0c\u5f02\u5e38\u8bb0\u5f55\uff0c\u7cfb\u7edf\u72b6\u6001\u76d1\u63a7\uff0c\u7a0b\u5e8f\u5d29\u6e83 \u65e5\u5fd7\u4e5f\u4e0d\u4f1a\u4e22\u5931\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T13:18:15+00:00\",\"dateModified\":\"2025-04-18T13:18:15+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/14578.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/14578.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/14578.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010C#\u3011 \u9ad8\u6548\u65e5\u5fd7\u6253\u5370 Logger\u4ee3\u7801\u5b9e\u73b0\u3010\u4e32\u53e3\u901a\u4fe1\u65e5\u5fd7\uff0c\u670d\u52a1\u5668\u65e5\u5fd7\uff0c\u5f02\u5e38\u8bb0\u5f55\uff0c\u7cfb\u7edf\u72b6\u6001\u76d1\u63a7\uff0c\u7a0b\u5e8f\u5d29\u6e83 \u65e5\u5fd7\u4e5f\u4e0d\u4f1a\u4e22\u5931\u3011\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010C#\u3011 \u9ad8\u6548\u65e5\u5fd7\u6253\u5370 Logger\u4ee3\u7801\u5b9e\u73b0\u3010\u4e32\u53e3\u901a\u4fe1\u65e5\u5fd7\uff0c\u670d\u52a1\u5668\u65e5\u5fd7\uff0c\u5f02\u5e38\u8bb0\u5f55\uff0c\u7cfb\u7edf\u72b6\u6001\u76d1\u63a7\uff0c\u7a0b\u5e8f\u5d29\u6e83 \u65e5\u5fd7\u4e5f\u4e0d\u4f1a\u4e22\u5931\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/14578.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010C#\u3011 \u9ad8\u6548\u65e5\u5fd7\u6253\u5370 Logger\u4ee3\u7801\u5b9e\u73b0\u3010\u4e32\u53e3\u901a\u4fe1\u65e5\u5fd7\uff0c\u670d\u52a1\u5668\u65e5\u5fd7\uff0c\u5f02\u5e38\u8bb0\u5f55\uff0c\u7cfb\u7edf\u72b6\u6001\u76d1\u63a7\uff0c\u7a0b\u5e8f\u5d29\u6e83 \u65e5\u5fd7\u4e5f\u4e0d\u4f1a\u4e22\u5931\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb816\u6b21\uff0c\u70b9\u8d5e29\u6b21\uff0c\u6536\u85cf28\u6b21\u30021 .\u4f7f\u7528 StreamWriter \u5e76\u5f00\u542f AutoFlush = true\uff1a\u907f\u514d\u9891\u7e41\u6253\u5f00\/\u5173\u95ed\u6587\u4ef6\uff0c\u63d0\u9ad8\u5199\u5165\u6548\u7387\u3002\u6bcf\u6b21\u5199\u5165\u540e\uff0cStreamWriter \u81ea\u52a8\u5237\u65b0\uff0c\u4f46\u907f\u514d\u4e86 \u6bcf\u6b21\u4e8b\u4ef6\u8c03\u7528\u90fd\u91cd\u65b0\u521b\u5efa StreamWriter``\u30024.\u65e5\u5fd7\u6309\u65e5\u671f\u5206\u7c7b\u5b58\u50a8\uff1a\u6bcf\u5929\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u65e5\u5fd7\u6587\u4ef6\uff0c\u907f\u514d\u5355\u4e2a\u6587\u4ef6\u8fc7\u5927\u5f71\u54cd\u6027\u80fd\u3002\uff0c\u5bf9\u4e8e\u4e8b\u4ef6\u53ef\u4ee5\u7406\u89e3\u4e3a\u7ebf\u7a0b\uff0c\u8fd9\u91cc\u540c\u65f6\u542f\u52a8\u4e24\u4e2a\u4e8b\u4ef6\uff0c\u5c31\u76f8\u5f53\u4e8e\u5f00\u4e86\u4e24\u4e2a\u7ebf\u7a0b\u3002\u6216 \u540e\u53f0\u7ebf\u7a0b \u5904\u7406\u65e5\u5fd7\u5199\u5165\uff0c\u51cf\u5c11 \u4e8b\u4ef6\u5904\u7406\u51fd\u6570 \u53d7\u5230\u7684\u5f71\u54cd\u3002\uff0c\u5e76\u5728\u5355\u72ec\u7684\u540e\u53f0\u7ebf\u7a0b\u4e2d\u5199\u5165\u65e5\u5fd7\uff0c\u51cf\u5c11\u5bf9\u4e3b\u7ebf\u7a0b\u7684\u5f71\u54cd\u3002_c# logger","og_url":"https:\/\/www.wsisp.com\/helps\/14578.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T13:18:15+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/14578.html","url":"https:\/\/www.wsisp.com\/helps\/14578.html","name":"\u3010C#\u3011 \u9ad8\u6548\u65e5\u5fd7\u6253\u5370 Logger\u4ee3\u7801\u5b9e\u73b0\u3010\u4e32\u53e3\u901a\u4fe1\u65e5\u5fd7\uff0c\u670d\u52a1\u5668\u65e5\u5fd7\uff0c\u5f02\u5e38\u8bb0\u5f55\uff0c\u7cfb\u7edf\u72b6\u6001\u76d1\u63a7\uff0c\u7a0b\u5e8f\u5d29\u6e83 \u65e5\u5fd7\u4e5f\u4e0d\u4f1a\u4e22\u5931\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T13:18:15+00:00","dateModified":"2025-04-18T13:18:15+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/14578.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/14578.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/14578.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010C#\u3011 \u9ad8\u6548\u65e5\u5fd7\u6253\u5370 Logger\u4ee3\u7801\u5b9e\u73b0\u3010\u4e32\u53e3\u901a\u4fe1\u65e5\u5fd7\uff0c\u670d\u52a1\u5668\u65e5\u5fd7\uff0c\u5f02\u5e38\u8bb0\u5f55\uff0c\u7cfb\u7edf\u72b6\u6001\u76d1\u63a7\uff0c\u7a0b\u5e8f\u5d29\u6e83 \u65e5\u5fd7\u4e5f\u4e0d\u4f1a\u4e22\u5931\u3011"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/14578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=14578"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/14578\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=14578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=14578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=14578"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=14578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}