{"id":16888,"date":"2025-04-18T23:17:22","date_gmt":"2025-04-18T15:17:22","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/16888.html"},"modified":"2025-04-18T23:17:22","modified_gmt":"2025-04-18T15:17:22","slug":"sylar%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%a1%86%e6%9e%b6-%e6%97%a5%e5%bf%97%e7%af%87%ef%bc%88%e6%a8%a1%e5%9d%97%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/16888.html","title":{"rendered":"sylar\u7684\u670d\u52a1\u5668\u6846\u67b6 - \u65e5\u5fd7\u7bc7\uff08\u6a21\u5757\uff09"},"content":{"rendered":"<h3>\u524d\u8a00<\/h3>\n<p>\u672c\u7bc7\u662f\u65e5\u5fd7\u7bc7\uff0c\u6d41\u7a0b\u662f\u6309\u7167\u81ea\u5df1\u5bf9sylar\u670d\u52a1\u5668\u6846\u67b6\u89c6\u9891\u7684\u7406\u89e3\u8fdb\u884c\u7801\u5b57\uff0c\u90e8\u5206\u4ee3\u7801\u53ef\u80fd\u4f1a\u51fa\u73b0\u4e00\u4e9b\u5dee\u522b\uff0c\u53ea\u8981\u8f93\u51fa\u5185\u5bb9\u6ca1\u4ec0\u4e48\u95ee\u9898\u57fa\u672c\u5c31\u662fOK\u7684\u3002<\/p>\n<h3>\u4ee3\u7801\u6d41\u7a0b<\/h3>\n<h4>\u8f93\u51fa\u7ed3\u679c<\/h4>\n<p>\u9996\u5148\u5148\u770b\u4e00\u4e0b\u65e5\u5fd7\u7684\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u65e5\u671f &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u7ebf\u7a0b\u53f7 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u534f\u7a0b\u53f7 \u65e5\u5fd7\u7ea7\u522b \u65e5\u5fd7\u540d\u79f0 \u6587\u4ef6\u540d&nbsp; &nbsp; \u884c\u53f7 \u5185\u5bb9<\/p>\n<p>2025-01-11 17:47:10 63450 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [WARM] [SMlog]&nbsp; &nbsp; &nbsp;main.cc :36 message<\/p>\n<h4>\u57fa\u672c\u6846\u67b6\uff08\u524d\u671f\uff09<\/h4>\n<p>\u524d\u671f\u4e3b\u8981\u662f\u5305\u62ec\u4e94\u4e2a\u90e8\u5206\uff1a<\/p>\n<p>\u4e00\u662f\u65e5\u5fd7\u7ea7\u522b \uff1a&nbsp; \u5c31\u662f\u65e5\u5fd7\u6309\u7167\u7b49\u7ea7\u5206\u7c7b<\/p>\n<p>\u4e8c\u662f\u65e5\u5fd7\u4e8b\u4ef6\uff1a\u5c31\u662f\u65e5\u5fd7\u7684\u7ec4\u6210\u90e8\u5206&nbsp; \u65e5\u671f&nbsp; \u7ebf\u7a0b\u53f7&nbsp; \u534f\u7a0b\u53f7&nbsp; \u65e5\u5fd7\u7ea7\u522b&nbsp; \u6587\u4ef6\u540d&nbsp; &nbsp; \u884c\u53f7 \u5185\u5bb9&nbsp; \u8fd9\u4e9b<\/p>\n<p>\u4e09\u662f\u65e5\u5fd7\u5668 \uff1a\u65e5\u5fd7\u540d\u79f0 \u65e5\u5fd7\u7ea7\u522b\u9608\u503c\uff08\u53ea\u6709logevent\u4e2d\u7684\u7ea7\u522b\u5c0f\u4e8e\u8fd9\u4e2a\u8bbe\u7f6e\u7ea7\u522b\u9608\u503c\uff0c\u624d\u53ef\u4ee5\u8f93\u51fa\uff09 \u65e5\u5fd7\u7684\u7ba1\u7406\u8f93\u51fa\uff1a\u771f\u5b9e\u7684\u8f93\u51fa\u662flogAppend\u7c7b\u7684log\uff1b<\/p>\n<p>\u56db\u662f\u65e5\u5fd7\u8f93\u51fa\u5730\uff1a\u65e5\u5fd7\u53ef\u4ee5\u5728\u7ec8\u7aef\u8f93\u51fa&nbsp; \u8fd8\u53ef\u4ee5\u5728\u6587\u4ef6\u4e2d\u8fdb\u884c\u8f93\u51fa&nbsp; \u8fd8\u662f\u8f93\u51fa\u5230\u8fdc\u7a0b\u670d\u52a1\u5668<\/p>\n<p>\u4e94\u662f\u65e5\u5fd7\u683c\u5f0f\u5668\uff1a\u4f20\u5165logevent\u662f\u4e71\u5e8f\u7684\uff0c\u7ecf\u8fc7\u65e5\u5fd7\u683c\u5f0f\u5668\u7684\u89e3\u6790\u548c\u548c\u7ec4\u88c5\u624d\u53ef\u4ee5\u6309\u7167\u6211\u4eec\u60f3\u8981\u7684\u683c\u5f0f\u8fdb\u884c\u8f93\u51fa\uff1b<\/p>\n<p>\u524d\u671f\u5148\u7b80\u5355\u5b9e\u73b0\u8fd9\u4e94\u4e2a\u90e8\u5206\uff0c\u540e\u671f\u5728\u52a0\u4e0a\u5176\u4ed6\u90e8\u5206\u5e76\u4e14\u5bf9\u8fd9\u4e94\u4e2a\u90e8\u5206\u8fdb\u884c\u4f18\u5316\uff0c\u672c\u7bc7\u4ee3\u7801\u53ef\u80fd\u524d\u671f\u548c\u540e\u671f\u4f1a\u6709\u4e9b\u6709\u4e9b\u4fee\u6539\uff0c\u5177\u4f53\u5b8c\u5168\u4f53\u4ee3\u7801\u8bf7\u770b\u4ee3\u7801\u7bc7\u3002<\/p>\n<p>\u5934\u6587\u4ef6<\/p>\n<p>#ifndef __LOG_H__<br \/>\n#define __LOG_H__<br \/>\n#include&lt;stdint.h&gt;<br \/>\n#include&lt;string&gt;<br \/>\n#include&lt;memory&gt;<br \/>\n#include&lt;list&gt;<br \/>\n#include&lt;time.h&gt;<\/p>\n<p>namespace sylar<br \/>\n{<\/p>\n<p>    \/\/ \u65e5\u5fd7\u7ea7\u522b<br \/>\n    class LogLevel<br \/>\n    {<br \/>\n    public:<br \/>\n        enum Level<br \/>\n        {<br \/>\n            UNKNOW = 0, \/\/ \u672a\u77e5<br \/>\n            DEBUG = 1,  \/\/ \u8c03\u8bd5<br \/>\n            INFO = 2,   \/\/ \u8f93\u51fa<br \/>\n            WARN = 3,   \/\/ \u8b66\u544a<br \/>\n            ERROR = 4,  \/\/ \u9519\u8bef<br \/>\n            FETAL = 5,  \/\/ \u707e\u96be<br \/>\n        };<br \/>\n    };<\/p>\n<p>    class Logger;<\/p>\n<p>    \/\/ \u65e5\u5fd7\u4e8b\u4ef6<br \/>\n    class LogEvent<br \/>\n    {<br \/>\n    public:<br \/>\n        typedef std::shared_ptr&lt;LogEvent&gt; ptr;<br \/>\n        \/\/ \u6709\u53c2\u6784\u9020<br \/>\n        LogEvent(LogLevel::Level level, uint64_t dateTime, uint32_t threadId, uint32_t fiberId, const char *file, uint32_t line, const std::string &amp;message);<br \/>\n        \/\/ \u6790\u6784<br \/>\n        ~LogEvent() = default;<br \/>\n        \/\/ \u83b7\u5f97\u65e5\u671f<br \/>\n        uint64_t getDateTime() const { return dateTime_; }<br \/>\n        \/\/ \u83b7\u5f97\u7ebf\u7a0b\u53f7<br \/>\n        uint32_t getThreadId() const { return threadId_; }<br \/>\n        \/\/ \u83b7\u5f97\u534f\u7a0b\u53f7<br \/>\n        uint32_t getFiberId() const { return fiberId_; }<br \/>\n        \/\/ \u83b7\u5f97\u65e5\u5fd7\u7ea7\u522b<br \/>\n        LogLevel::Level getLevel() const { return level_; }<br \/>\n        \/\/ \u83b7\u5f97\u6587\u4ef6\u540d<br \/>\n        const char *getFile() const { return file_; }<br \/>\n        \/\/ \u83b7\u5f97\u884c\u53f7<br \/>\n        uint32_t getLine() const { return line_; }<br \/>\n        \/\/ \u8f93\u51fa\u5185\u5bb9<br \/>\n        const std::string &amp;getMessage() const { return message_; }<br \/>\n        \/\/ \u83b7\u5f97\u8fd0\u884c\u65f6\u95f4<br \/>\n        uint32_t getElapse() const { return elapse_; }<\/p>\n<p>    private:<br \/>\n        uint64_t dateTime_ = 0;      \/\/ \u65e5\u671f<br \/>\n        uint32_t threadId_ = 0;      \/\/ \u7ebf\u7a0b\u53f7<br \/>\n        uint32_t fiberId_ = 0;       \/\/ \u534f\u7a0b\u53f7<br \/>\n        LogLevel::Level level_;      \/\/ \u65e5\u5fd7\u7ea7\u522b<br \/>\n        const char *file_ = nullptr; \/\/ \u6587\u4ef6\u540d<br \/>\n        uint32_t line_ = 0;          \/\/ \u884c\u53f7<br \/>\n        std::string message_ = \\&#8221;\\&#8221;;   \/\/ \u8f93\u51fa\u5185\u5bb9<br \/>\n        uint32_t elapse_ = 0;        \/\/ \u7cfb\u7edf\u8fd0\u884c\u65f6\u95f4<br \/>\n    };<\/p>\n<p>    \/\/ \u65e5\u5fd7\u8f93\u51fa\u76ee\u7684\u5730<br \/>\n    class LogAppend<br \/>\n    {<br \/>\n    public:<br \/>\n        typedef std::shared_ptr&lt;LogAppend&gt; ptr;<br \/>\n        \/\/\u6709\u53c2\u6784\u9020<br \/>\n        LogAppend() = default;<br \/>\n        \/\/\u6790\u6784\u51fd\u6570<br \/>\n        virtual ~LogAppend(){}<br \/>\n        \/\/log\u9700\u8981event\u4e2d\u7684\u6210\u5458  \u8fd8\u6709logger\u4e2d\u7684name<br \/>\n        virtual void log(std::shared_ptr&lt;Logger&gt; logger,std::shared_ptr&lt;LogEvent&gt; event) = 0;<br \/>\n    protected:<\/p>\n<p>    };<\/p>\n<p>    \/\/\u8f93\u51fa\u5230\u7ec8\u7aef<br \/>\n    class ToStdLogAppend:public LogAppend<br \/>\n    {<br \/>\n        public:<br \/>\n        typedef std::shared_ptr&lt;ToStdLogAppend&gt; ptr;<br \/>\n        \/\/\u6790\u6784<br \/>\n        virtual ~ToStdLogAppend()override{}<br \/>\n        \/\/log\u8f93\u51fa\u51fd\u6570<br \/>\n        virtual void log(std::shared_ptr&lt;Logger&gt; logger,std::shared_ptr&lt;LogEvent&gt; event)override;<br \/>\n        private:<\/p>\n<p>    };<br \/>\n    \/\/\u8f93\u51fa\u5230\u6587\u4ef6<br \/>\n    class ToFileLogAppend:public LogAppend<br \/>\n    {<br \/>\n        public:<br \/>\n        typedef std::shared_ptr&lt;ToFileLogAppend&gt;ptr;<br \/>\n        \/\/\u6709\u53c2\u6784\u9020<br \/>\n        ToFileLogAppend(const std::string&amp; name);<br \/>\n        \/\/\u6790\u6784<br \/>\n        virtual ~ToFileLogAppend()override{}<br \/>\n        \/\/log\u8f93\u51fa\u51fd\u6570<br \/>\n        virtual void log(std::shared_ptr&lt;Logger&gt; logger,std::shared_ptr&lt;LogEvent&gt; event)override;<br \/>\n        private:<br \/>\n        std::string name_;  \/\/\u6587\u4ef6\u540d<br \/>\n    };<\/p>\n<p>    \/\/ \u65e5\u5fd7\u5668<br \/>\n    class Logger:public std::enable_shared_from_this&lt;Logger&gt;<br \/>\n    {<br \/>\n    public:<br \/>\n        typedef std::shared_ptr&lt;Logger&gt;ptr;<br \/>\n        \/\/ \u6709\u53c2\u6784\u9020<br \/>\n        Logger(LogLevel::Level level, std::string name = \\&#8221;root\\&#8221;);<br \/>\n        \/\/ \u6790\u6784\u51fd\u6570<br \/>\n        ~Logger() = default;<br \/>\n        \/\/ \u8c03\u5ea6\u8f93\u51fa  \u771f\u5b9e\u7684\u8f93\u51fa\u662fLogAppend\u4e2d\u7684log<br \/>\n        void log(std::shared_ptr&lt;LogEvent&gt;event);<br \/>\n        \/\/\u6dfb\u52a0\u65e5\u5fd7\u8f93\u51fa\u5730<br \/>\n        void addAppend(std::shared_ptr&lt;LogAppend&gt;append);<br \/>\n        \/\/\u5220\u9664\u65e5\u5fd7\u8f93\u51fa\u5730<br \/>\n        bool delAppend(std::shared_ptr&lt;LogAppend&gt;append);<br \/>\n        \/\/ \u83b7\u5f97\u65e5\u5fd7\u5668\u540d\u5b57<br \/>\n        const std::string &amp;getName() const { return name_;}<br \/>\n        \/\/\u83b7\u5f97\u65e5\u5fd7\u7ea7\u522b\u9608\u503c<br \/>\n        LogLevel::Level getLevel() const {return level_;}<br \/>\n    private:<br \/>\n        std::string name_;                              \/\/ \u65e5\u5fd7\u540d\u79f0<br \/>\n        LogLevel::Level level_;                         \/\/ \u65e5\u5fd7\u7ea7\u522b\u9608\u503c<br \/>\n        std::list&lt;std::shared_ptr&lt;LogAppend&gt;&gt; appends_; \/\/ \u771f\u5b9e\u7684\u8f93\u51fa\u7c7b<br \/>\n    };<\/p>\n<p>    \/\/ \u65e5\u5fd7\u89e3\u6790\u5668<br \/>\n    class LogFormatter<br \/>\n    {<br \/>\n    public:<\/p>\n<p>    private:<\/p>\n<p>    };<\/p>\n<p>}<\/p>\n<p>#endif <\/p>\n<p>\u6e90\u6587\u4ef6<\/p>\n<p>#include \\&#8221;log.h\\&#8221;<br \/>\n#include&lt;iostream&gt;<\/p>\n<p>namespace sylar<br \/>\n{<br \/>\n    \/\/\/LogEvent<br \/>\n    \/\/ \u6784\u9020\u51fd\u6570  \u4f20\u65e5\u5fd7\u53c2\u6570<br \/>\n    LogEvent::LogEvent(LogLevel::Level level, uint64_t dateTime, uint32_t threadId,<br \/>\n                       uint32_t fiberId, const char *file, uint32_t line, const std::string &amp;message)<br \/>\n        : level_(level), dateTime_(dateTime), threadId_(threadId),<br \/>\n          fiberId_(fiberId), file_(file), line_(line), message_(message)<br \/>\n    {<\/p>\n<p>    }<\/p>\n<p>    \/\/\/Logger<br \/>\n    \/\/ \u6709\u53c2\u6784\u9020  \u4f20\u65e5\u5fd7\u53c2\u6570<br \/>\n    Logger::Logger(LogLevel::Level level, std::string name):name_(name),level_(level)<br \/>\n    {<\/p>\n<p>    }<\/p>\n<p>    \/\/ \u8c03\u5ea6\u8f93\u51fa  \u771f\u5b9e\u7684\u8f93\u51fa\u662fLogAppend\u4e2d\u7684log<br \/>\n    void Logger::log(std::shared_ptr&lt;LogEvent&gt;event)<br \/>\n    {<br \/>\n        \/\/\u771f\u5b9e\u8f93\u51fa<br \/>\n        auto self = shared_from_this();<br \/>\n        for(auto it:appends_)<br \/>\n        {<br \/>\n          it -&gt;log(self,event);<br \/>\n        }<br \/>\n    }<\/p>\n<p>    \/\/ \u6dfb\u52a0\u65e5\u5fd7\u8f93\u51fa\u5730<br \/>\n    void Logger::addAppend(std::shared_ptr&lt;LogAppend&gt; append)<br \/>\n    {<br \/>\n        for(auto it : appends_)<br \/>\n        {<br \/>\n            \/\/\u5982\u679c\u76f8\u7b49\u8bf4\u660e\u5df2\u7ecf\u5b58\u5728 \u5c31\u4e0d\u7528\u6dfb\u52a0\u8fd9\u4e2a\u8f93\u51fa\u8def\u5f84\u4e86<br \/>\n            if(it == append)<br \/>\n            {<br \/>\n                return ;<br \/>\n            }<br \/>\n        }<br \/>\n        \/\/\u6ca1\u6709\u8be5\u8def\u5f84\u5c31\u6dfb\u52a0<br \/>\n        appends_.push_back(append);<br \/>\n    }<br \/>\n    \/\/ \u5220\u9664\u65e5\u5fd7\u8f93\u51fa\u5730<br \/>\n    bool Logger::delAppend(std::shared_ptr&lt;LogAppend&gt; append)<br \/>\n    {<br \/>\n        for(auto it = appends_.begin();it!= appends_.end();it++)<br \/>\n        {<br \/>\n            if(*it == append)<br \/>\n            {<br \/>\n                \/\/\u627e\u5230\u5c31\u5220\u9664<br \/>\n                appends_.erase(it);<br \/>\n                return true;<br \/>\n            }<br \/>\n        }<br \/>\n        \/\/\u6ca1\u627e\u5230\u8fd4\u56de\u6ca1\u627e\u5230<br \/>\n        return false;<br \/>\n    }<\/p>\n<p>    \/\/LogAppend<\/p>\n<p>    \/\/\u8f93\u51fa\u5230\u7ec8\u7aef<br \/>\n        \/\/log\u771f\u5b9e\u7684\u8f93\u51fa \u7c7b\u5185\u58f0\u660e\u52a0virtual  \u7c7b\u5916\u4e0d\u7528\u518d\u52a0virtual<br \/>\n        void ToStdLogAppend::log(std::shared_ptr&lt;Logger&gt; logger,std::shared_ptr&lt;LogEvent&gt; event)<br \/>\n        {<br \/>\n            if(event-&gt;getLevel()&lt;=logger-&gt;getLevel())<br \/>\n            {<br \/>\n                std::cout&lt;&lt;event-&gt;getDateTime()&lt;&lt;\\&#8221; \\&#8221;<br \/>\n                    &lt;&lt;event-&gt;getThreadId()&lt;&lt;\\&#8221; \\&#8221;<br \/>\n                    &lt;&lt;event-&gt;getFiberId()&lt;&lt;\\&#8221; \\&#8221;<br \/>\n                    &lt;&lt;event-&gt;getLevel()&lt;&lt;\\&#8221; \\&#8221;<br \/>\n                    &lt;&lt;logger-&gt;getName()&lt;&lt;\\&#8221; \\&#8221;<br \/>\n                    &lt;&lt;event-&gt;getFile()&lt;&lt;\\&#8221; : \\&#8221;<br \/>\n                    &lt;&lt;event-&gt;getLine()&lt;&lt;\\&#8221; \\&#8221;<br \/>\n                    &lt;&lt;event-&gt;getMessage()&lt;&lt;std::endl;<br \/>\n            }<br \/>\n        }<br \/>\n    \/\/\u8f93\u51fa\u5230\u6587\u4ef6<br \/>\n        \/\/\u6709\u53c2\u6784\u9020<br \/>\n        ToFileLogAppend::ToFileLogAppend(const std::string&amp; name):name_(name)<br \/>\n        {<\/p>\n<p>        }<br \/>\n        \/\/log\u8f93\u51fa\u51fd\u6570<br \/>\n       void ToFileLogAppend::log(std::shared_ptr&lt;Logger&gt; logger,std::shared_ptr&lt;LogEvent&gt; event)<br \/>\n       {<br \/>\n            std::cout&lt;&lt;\\&#8221;\u8f93\u51fa\u5230file\\&#8221;&lt;&lt;std::endl;<br \/>\n       }<\/p>\n<p>} <\/p>\n<p>\u6d4b\u8bd5<\/p>\n<p>#include&lt;iostream&gt;<br \/>\n#include\\&#8221;log.h\\&#8221;<\/p>\n<p>int main()<br \/>\n{<br \/>\n    sylar::Logger::ptr logger(new sylar::Logger(sylar::LogLevel::INFO,\\&#8221;system\\&#8221;));<br \/>\n    sylar::LogEvent::ptr event(new sylar::LogEvent(sylar::LogLevel::DEBUG,time(0),555,0,\\&#8221;log.txt\\&#8221;,10,\\&#8221;hello world\\&#8221;));<br \/>\n    sylar::LogAppend::ptr logappend(new sylar::ToStdLogAppend());<br \/>\n    logger-&gt;addAppend(logappend);<br \/>\n    logger-&gt;log(event);<br \/>\n    return 0;<br \/>\n} <\/p>\n<p>\u7f16\u8bd1\uff1a<\/p>\n<p>g++ -o project log.cc logtest1.cc -std=c++11<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"18\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418151721-68026d01cecff.png\" width=\"366\"><\/p>\n<p>\u4e5f\u662f\u5199\u7684\u7b2c\u56db\u904d\uff0c\u6ca1\u60f3\u5230\u7f16\u8bd1\u4e00\u4e0b\u5c31\u901a\u8fc7\u4e86\uff0c\u6240\u4ee5\u5927\u5bb6\u4e00\u5b9a\u8981\u591a\u5199\uff0c\u867d\u7136\u8fd9\u4e2a\u9879\u76ee\u5bf9\u6211\u4eec\u5b66\u4e60\u8005\u56f0\u96be\uff0c\u4f46\u662f\u53ea\u8981\u4e0d\u65ad\u7684\u7ec3\u4e60\u548c\u5206\u6790\u548c\u603b\u7ed3\uff0c\u4e00\u5b9a\u80fd\u6709\u7279\u522b\u5927\u7684\u6536\u83b7\u3002<\/p>\n<p>\u76ee\u524d\u6211\u4eec\u5df2\u7ecf\u80fd\u8f93\u51fa\u4e86\uff0c\u4f46\u662f\u8fd9\u5e76\u4e0d\u662f\u6211\u4eec\u60f3\u8981\u7684\u7ed3\u679c\uff0c\u96cf\u5f62\u5df2\u7ecf\u5f62\u6210\u4e86\uff0c\u4e0b\u4e00\u6b65\u5c31\u662f\u4e0d\u65ad\u4e30\u5bcc\u4ee3\u7801\uff0c\u4e00\u6b65\u4e00\u6b65\u7684\u5b9e\u73b0\u6700\u7ec8\u7ed3\u679c\u3002\u4e0b\u4e00\u6b65\u6211\u4eec\u5148\u5b8c\u6210LogLevel\u7684\u95ee\u9898\uff0c\u76ee\u524d\u6211\u4eec\u8f93\u51fa\u7684\u662f\u6570\u5b57\uff0c\u4e0b\u4e00\u6b65\u6211\u4eec\u628a\u4ed6\u5b9e\u73b0\u4e3a[ XXXX ]\u7684\u5f62\u5f0f.<\/p>\n<h3>\u4ee3\u7801\u5b9e\u73b0:&nbsp; LogLevel\u6b63\u786e\u8f93\u51fa<\/h3>\n<p>sylar\u4f7f\u7528\u4e86\u5b8f\u5b9a\u4e49\u7684<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb975\u6b21\uff0c\u70b9\u8d5e22\u6b21\uff0c\u6536\u85cf14\u6b21\u3002\u672c\u7bc7\u662f\u65e5\u5fd7\u7bc7\uff0c\u6d41\u7a0b\u662f\u6309\u7167\u81ea\u5df1\u5bf9sylar\u670d\u52a1\u5668\u6846\u67b6\u89c6\u9891\u7684\u7406\u89e3\u8fdb\u884c\u7801\u5b57\uff0c\u90e8\u5206\u4ee3\u7801\u53ef\u80fd\u4f1a\u51fa\u73b0\u4e00\u4e9b\u5dee\u522b\uff0c\u53ea\u8981\u8f93\u51fa\u5185\u5bb9\u6ca1\u4ec0\u4e48\u95ee\u9898\u57fa\u672c\u5c31\u662fOK\u7684\u3002\u5230\u8fd9\u91cc\u672c\u7ae0\u8282\u5185\u5bb9\u57fa\u672c\u5b8c\u6210\u4e86\uff0c\u90e8\u5206\u5185\u5bb9\u8ddfsylar\u7684\u6709\u4e9b\u4e0d\u540c\uff0c\u7136\u540e\u524d\u4e9b\u5929\u4e5f\u8bd5\u7740\u5199\u8fc7\u4e00\u6b21\u6a21\u5757\u7bc7\uff0c\u7ed3\u679c\u662f\u601d\u8def\u4e71\u7cdf\u7cdf\u7684\uff0c\u53ef\u80fd\u662f\u81ea\u5df1\u5bf9\u672c\u7bc7\u7684\u7406\u89e3\u4e0d\u8db3\uff0c\u7136\u540e\u5c31\u662f\u81ea\u5df1\u7684\u4ee3\u7801\u91cf\u592a\u5c11\uff0c\u5199\u7684\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u4eca\u5929\u5c1d\u8bd5\u7740\u91cd\u65b0\u5199\u4e00\u6b21\uff0c\u867d\u7136\u601d\u8def\u8fd8\u662f\u6bd4\u8f83\u4e71\uff0c\u4f46\u660e\u663e\u6bd4\u4e0a\u4e00\u6b21\u597d\u591a\u4e86\u3002\u7136\u540e\u8fd9\u4e5f\u662f\u7b2c\u4e00\u6b21\u5199\u535a\u5ba2\uff0c\u6807\u9898\u90fd\u4e0d\u80fd\u660e\u786e\u7684\u8bf4\u6e05\u662f\u5e72\u561b\uff0c\u4f46\u5728\u63a5\u4e0b\u6765\u6a21\u5757\u80af\u5b9a\u52aa\u529b\u4e0d\u65ad\u8fdb\u6b65\u3002_sylar\u670d\u52a1\u5668<\/p>\n","protected":false},"author":2,"featured_media":16887,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,92,58,1209,100,43],"topic":[],"class_list":["post-16888","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-c","tag-github","tag-linux","tag-sylar","tag-100","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>sylar\u7684\u670d\u52a1\u5668\u6846\u67b6 - \u65e5\u5fd7\u7bc7\uff08\u6a21\u5757\uff09 - \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\/16888.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"sylar\u7684\u670d\u52a1\u5668\u6846\u67b6 - \u65e5\u5fd7\u7bc7\uff08\u6a21\u5757\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb975\u6b21\uff0c\u70b9\u8d5e22\u6b21\uff0c\u6536\u85cf14\u6b21\u3002\u672c\u7bc7\u662f\u65e5\u5fd7\u7bc7\uff0c\u6d41\u7a0b\u662f\u6309\u7167\u81ea\u5df1\u5bf9sylar\u670d\u52a1\u5668\u6846\u67b6\u89c6\u9891\u7684\u7406\u89e3\u8fdb\u884c\u7801\u5b57\uff0c\u90e8\u5206\u4ee3\u7801\u53ef\u80fd\u4f1a\u51fa\u73b0\u4e00\u4e9b\u5dee\u522b\uff0c\u53ea\u8981\u8f93\u51fa\u5185\u5bb9\u6ca1\u4ec0\u4e48\u95ee\u9898\u57fa\u672c\u5c31\u662fOK\u7684\u3002\u5230\u8fd9\u91cc\u672c\u7ae0\u8282\u5185\u5bb9\u57fa\u672c\u5b8c\u6210\u4e86\uff0c\u90e8\u5206\u5185\u5bb9\u8ddfsylar\u7684\u6709\u4e9b\u4e0d\u540c\uff0c\u7136\u540e\u524d\u4e9b\u5929\u4e5f\u8bd5\u7740\u5199\u8fc7\u4e00\u6b21\u6a21\u5757\u7bc7\uff0c\u7ed3\u679c\u662f\u601d\u8def\u4e71\u7cdf\u7cdf\u7684\uff0c\u53ef\u80fd\u662f\u81ea\u5df1\u5bf9\u672c\u7bc7\u7684\u7406\u89e3\u4e0d\u8db3\uff0c\u7136\u540e\u5c31\u662f\u81ea\u5df1\u7684\u4ee3\u7801\u91cf\u592a\u5c11\uff0c\u5199\u7684\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u4eca\u5929\u5c1d\u8bd5\u7740\u91cd\u65b0\u5199\u4e00\u6b21\uff0c\u867d\u7136\u601d\u8def\u8fd8\u662f\u6bd4\u8f83\u4e71\uff0c\u4f46\u660e\u663e\u6bd4\u4e0a\u4e00\u6b21\u597d\u591a\u4e86\u3002\u7136\u540e\u8fd9\u4e5f\u662f\u7b2c\u4e00\u6b21\u5199\u535a\u5ba2\uff0c\u6807\u9898\u90fd\u4e0d\u80fd\u660e\u786e\u7684\u8bf4\u6e05\u662f\u5e72\u561b\uff0c\u4f46\u5728\u63a5\u4e0b\u6765\u6a21\u5757\u80af\u5b9a\u52aa\u529b\u4e0d\u65ad\u8fdb\u6b65\u3002_sylar\u670d\u52a1\u5668\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/16888.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-18T15:17:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418151721-68026d01cecff.png\" \/>\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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/16888.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/16888.html\",\"name\":\"sylar\u7684\u670d\u52a1\u5668\u6846\u67b6 - \u65e5\u5fd7\u7bc7\uff08\u6a21\u5757\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T15:17:22+00:00\",\"dateModified\":\"2025-04-18T15:17:22+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/16888.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/16888.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/16888.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"sylar\u7684\u670d\u52a1\u5668\u6846\u67b6 - \u65e5\u5fd7\u7bc7\uff08\u6a21\u5757\uff09\"}]},{\"@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":"sylar\u7684\u670d\u52a1\u5668\u6846\u67b6 - \u65e5\u5fd7\u7bc7\uff08\u6a21\u5757\uff09 - \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\/16888.html","og_locale":"zh_CN","og_type":"article","og_title":"sylar\u7684\u670d\u52a1\u5668\u6846\u67b6 - \u65e5\u5fd7\u7bc7\uff08\u6a21\u5757\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb975\u6b21\uff0c\u70b9\u8d5e22\u6b21\uff0c\u6536\u85cf14\u6b21\u3002\u672c\u7bc7\u662f\u65e5\u5fd7\u7bc7\uff0c\u6d41\u7a0b\u662f\u6309\u7167\u81ea\u5df1\u5bf9sylar\u670d\u52a1\u5668\u6846\u67b6\u89c6\u9891\u7684\u7406\u89e3\u8fdb\u884c\u7801\u5b57\uff0c\u90e8\u5206\u4ee3\u7801\u53ef\u80fd\u4f1a\u51fa\u73b0\u4e00\u4e9b\u5dee\u522b\uff0c\u53ea\u8981\u8f93\u51fa\u5185\u5bb9\u6ca1\u4ec0\u4e48\u95ee\u9898\u57fa\u672c\u5c31\u662fOK\u7684\u3002\u5230\u8fd9\u91cc\u672c\u7ae0\u8282\u5185\u5bb9\u57fa\u672c\u5b8c\u6210\u4e86\uff0c\u90e8\u5206\u5185\u5bb9\u8ddfsylar\u7684\u6709\u4e9b\u4e0d\u540c\uff0c\u7136\u540e\u524d\u4e9b\u5929\u4e5f\u8bd5\u7740\u5199\u8fc7\u4e00\u6b21\u6a21\u5757\u7bc7\uff0c\u7ed3\u679c\u662f\u601d\u8def\u4e71\u7cdf\u7cdf\u7684\uff0c\u53ef\u80fd\u662f\u81ea\u5df1\u5bf9\u672c\u7bc7\u7684\u7406\u89e3\u4e0d\u8db3\uff0c\u7136\u540e\u5c31\u662f\u81ea\u5df1\u7684\u4ee3\u7801\u91cf\u592a\u5c11\uff0c\u5199\u7684\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u4eca\u5929\u5c1d\u8bd5\u7740\u91cd\u65b0\u5199\u4e00\u6b21\uff0c\u867d\u7136\u601d\u8def\u8fd8\u662f\u6bd4\u8f83\u4e71\uff0c\u4f46\u660e\u663e\u6bd4\u4e0a\u4e00\u6b21\u597d\u591a\u4e86\u3002\u7136\u540e\u8fd9\u4e5f\u662f\u7b2c\u4e00\u6b21\u5199\u535a\u5ba2\uff0c\u6807\u9898\u90fd\u4e0d\u80fd\u660e\u786e\u7684\u8bf4\u6e05\u662f\u5e72\u561b\uff0c\u4f46\u5728\u63a5\u4e0b\u6765\u6a21\u5757\u80af\u5b9a\u52aa\u529b\u4e0d\u65ad\u8fdb\u6b65\u3002_sylar\u670d\u52a1\u5668","og_url":"https:\/\/www.wsisp.com\/helps\/16888.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T15:17:22+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418151721-68026d01cecff.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/16888.html","url":"https:\/\/www.wsisp.com\/helps\/16888.html","name":"sylar\u7684\u670d\u52a1\u5668\u6846\u67b6 - \u65e5\u5fd7\u7bc7\uff08\u6a21\u5757\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T15:17:22+00:00","dateModified":"2025-04-18T15:17:22+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/16888.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/16888.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/16888.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"sylar\u7684\u670d\u52a1\u5668\u6846\u67b6 - \u65e5\u5fd7\u7bc7\uff08\u6a21\u5757\uff09"}]},{"@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\/16888","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=16888"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/16888\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/16887"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=16888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=16888"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=16888"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=16888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}