{"componentChunkName":"component---src-templates-blog-detail-tsx","path":"/blog/2020-04-13-time-log","result":{"data":{"currentBlog":{"id":"43f1b4b3-585f-5695-88a1-7611872268e3","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020415/1586926925568-Log.jpg","authors":["Anycodes"],"categories":["guides-and-tutorials"],"date":"2020-04-13T00:00:00.000Z","title":"实时日志：腾讯云 Serverless Python 运行时支持日志实时输出","description":"当我们在调试时，只要触发器被触发，就能实时看到日志，那对写代码肯定大有裨益，这个组件就完成了这么一件事儿！","authorslink":["https://www.zhihu.com/people/liuyu-43-97"],"translators":null,"translatorslink":null,"tags":["Serverless","Python"],"keywords":"Serverless 全局变量组件,Serverless 单独部署组件,Serverless Component","outdated":true},"wordCount":{"words":132,"sentences":40,"paragraphs":40},"fileAbsolutePath":"/opt/build/repo/content/blog/2020-04-13-time-log.md","fields":{"slug":"/blog/2020-04-13-time-log/","keywords":["go","python","serverless","spa","云函数","serverless","日志","time","service","scflog","实时"]},"html":"<h2 id=\"开发前言\"><a href=\"#%E5%BC%80%E5%8F%91%E5%89%8D%E8%A8%80\" aria-label=\"开发前言 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>开发前言</h2>\n<p>作为一名 Serverless 架构的重度使用者，我一直对调试感到恐慌：经常在测试接口的时候，会通过网页/PostMan 触发函数，然后没得到预期的结果，我就只能傻乎乎的一直点控制台的日志，等待他能早点出来结果，看看为啥和我预期结果不同。</p>\n<p><img src=\"https://img.serverlesscloud.cn/tmp/WX20200304-173503_20200304093539379762.png\"></p>\n<p>虽然说 10S，20S 的日志输出还能接受，但是在调试过程中，真的就是噩梦，一直在想有什么方法可以实现实时日志，我触发函数，就马上能看到，无论是控制台/API 网关还是 COS 触发器，只要被触发，我就能实时看到日志，这将会对我写代码，调试产生重大，超级重大帮助，所以我开发了这个组件。</p>\n<p>为了更加方便，清晰，直观，我这里做了个使用方法的教程：</p>\n<h2 id=\"使用方法教程：\"><a href=\"#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95%E6%95%99%E7%A8%8B%EF%BC%9A\" aria-label=\"使用方法教程： permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>使用方法教程：</h2>\n<h3 id=\"说明\"><a href=\"#%E8%AF%B4%E6%98%8E\" aria-label=\"说明 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>说明</h3>\n<p>该模块用于实现云函数 SCF Python Runtime 的实时日志功能，通过该组件，您可以实时查看到函数输出的日志（包括 print 和 logging 等），本组件目前在测试阶段，欢迎测试提意见，目前不建议上业务。</p>\n<h3 id=\"准备\"><a href=\"#%E5%87%86%E5%A4%87\" aria-label=\"准备 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>准备</h3>\n<ul>\n<li>安装 <code class=\"language-text\">scflog</code>：</li>\n</ul>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"81614818994373660000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`pip install scflog`, `81614818994373660000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">pip install scflog</code></pre></div>\n<p>安装时，可能需要 <code class=\"language-text\">root</code> 权限，否则可能无法使用。安装完成，可以执行 <code class=\"language-text\">scflog -v</code> 查看是否安装成功：</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"82166627284597400000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`scflog 0.1.1`, `82166627284597400000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">scflog 0.1.1</code></pre></div>\n<ul>\n<li>部署实时日志组件，新建项目，并且建立 <code class=\"language-text\">serverless.yaml</code>，内容：</li>\n</ul>\n<h3 id=\"组件部署\"><a href=\"#%E7%BB%84%E4%BB%B6%E9%83%A8%E7%BD%B2\" aria-label=\"组件部署 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>组件部署</h3>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"9739334496153230000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`PythonLogs:\n  component: '@gosls/tencent-pythonlogs'\n  inputs:\n    region: ap-guangzhou`, `9739334496153230000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">PythonLogs:\n  component: &#39;@gosls/tencent-pythonlogs&#39;\n  inputs:\n    region: ap-guangzhou</code></pre></div>\n<p>这里的参数是您要将这个组件部署的区域。该组件可以复用，也就是说这个组件部署完成之后可以一直被使用。</p>\n<p>通过 <code class=\"language-text\">sls --debug</code> 部署：</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"73973005485693440000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`DEBUG ─ Setting tags for function PythonRealTimeLogs_Cleanup\nDEBUG ─ Creating trigger for function PythonRealTimeLogs_Cleanup\nDEBUG ─ Deployed function PythonRealTimeLogs_Cleanup successful\n\nPythonLogs:\n    websocket: ws://service-laabz6zm-1256773370.gz.apigw.tencentcs.com/test/python_real_time_logs\n\n    26s › PythonLogs › done`, `73973005485693440000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">DEBUG ─ Setting tags for function PythonRealTimeLogs_Cleanup\nDEBUG ─ Creating trigger for function PythonRealTimeLogs_Cleanup\nDEBUG ─ Deployed function PythonRealTimeLogs_Cleanup successful\n\nPythonLogs:\n    websocket: ws://service-laabz6zm-1256773370.gz.apigw.tencentcs.com/test/python_real_time_logs\n\n    26s › PythonLogs › done</code></pre></div>\n<p>此时我们需要配置组件：</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"9409504599680950000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`scflog set -w ws://service-laabz6zm-1256773370.gz.apigw.tencentcs.com/test/python_real_time_logs`, `9409504599680950000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">scflog set -w ws://service-laabz6zm-1256773370.gz.apigw.tencentcs.com/test/python_real_time_logs</code></pre></div>\n<p>配置成功输出：</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"31313574763145335000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`DFOUNDERLIU-MB0:~ dfounderliu\\$ scflog set -w ws://service-laabz6zm-1256773370.gz.apigw.tencentcs.com/test/python_real_time_logs\n设置成功\n\twebsocket: ws://service-laabz6zm-1256773370.gz.apigw.tencentcs.com/test/python_real_time_logs\n\tregion: ap-guangzhou\n\tnamespace: default`, `31313574763145335000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">DFOUNDERLIU-MB0:~ dfounderliu$ scflog set -w ws://service-laabz6zm-1256773370.gz.apigw.tencentcs.com/test/python_real_time_logs\n设置成功\n\twebsocket: ws://service-laabz6zm-1256773370.gz.apigw.tencentcs.com/test/python_real_time_logs\n\tregion: ap-guangzhou\n\tnamespace: default</code></pre></div>\n<p>通过 <code class=\"language-text\">sls remove --debug</code> 移除</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"8200131496798413000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`DEBUG ─ Removing any previously deployed API. api-rzm1uzik\nDEBUG ─ Removing any previously deployed API. api-07wq4u9a\nDEBUG ─ Removing any previously deployed service. service-laabz6zm\n\n6s › PythonLogs › done`, `8200131496798413000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">DEBUG ─ Removing any previously deployed API. api-rzm1uzik\nDEBUG ─ Removing any previously deployed API. api-07wq4u9a\nDEBUG ─ Removing any previously deployed service. service-laabz6zm\n\n6s › PythonLogs › done</code></pre></div>\n<h3 id=\"项目中使用\"><a href=\"#%E9%A1%B9%E7%9B%AE%E4%B8%AD%E4%BD%BF%E7%94%A8\" aria-label=\"项目中使用 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>项目中使用</h3>\n<p>在项目中使用该组件的方法很简单。</p>\n<ul>\n<li>创建一个文件夹，并进入</li>\n</ul>\n<p><code class=\"language-text\">mkdir scflogs &amp;&amp; cd scflogs</code></p>\n<ul>\n<li>初始化项目</li>\n</ul>\n<p><code class=\"language-text\">scflog init</code></p>\n<ul>\n<li>创建 <code class=\"language-text\">index.py</code> 文件以及 <code class=\"language-text\">serverless.yaml</code> 文件：</li>\n</ul>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"75034522958556270000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`vim index.py`, `75034522958556270000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">vim index.py</code></pre></div>\n<p>内容是：</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"46306809570268560000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`from logs import *\nimport time\nimport logging\n\ndef main_handler(event, context):\n    print(&quot;event is: &quot;, event)\n    time.sleep(1)\n    logging.debug(&quot;this is debug_msg&quot;)\n    time.sleep(1)\n    logging.info(&quot;this is info_msg&quot;)\n    time.sleep(1)\n    logging.warning(&quot;this is warning_msg&quot;)\n    time.sleep(1)\n    logging.error(&quot;this is error_msg&quot;)\n    time.sleep(1)\n    logging.critical(&quot;this is critical_msg&quot;)\n    time.sleep(1)\n    print(&quot;context is: &quot;, event)\n    return &quot;hello world&quot;`, `46306809570268560000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">from logs import *\nimport time\nimport logging\n\ndef main_handler(event, context):\n    print(&quot;event is: &quot;, event)\n    time.sleep(1)\n    logging.debug(&quot;this is debug_msg&quot;)\n    time.sleep(1)\n    logging.info(&quot;this is info_msg&quot;)\n    time.sleep(1)\n    logging.warning(&quot;this is warning_msg&quot;)\n    time.sleep(1)\n    logging.error(&quot;this is error_msg&quot;)\n    time.sleep(1)\n    logging.critical(&quot;this is critical_msg&quot;)\n    time.sleep(1)\n    print(&quot;context is: &quot;, event)\n    return &quot;hello world&quot;</code></pre></div>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"89039929582570290000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`vim serverless.yaml`, `89039929582570290000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">vim serverless.yaml</code></pre></div>\n<p>内容是：</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"88190034309663570000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`Hello_World:\n  component: &quot;@serverless/tencent-scf&quot;\n  inputs:\n    name: Hello_World\n    codeUri: ./\n    handler: index.main_handler\n    runtime: Python3.6\n    region: ap-guangzhou\n    description: My Serverless Function\n    memorySize: 64\n    timeout: 20\n    exclude:\n      - .gitignore\n      - .git/**\n      - node_modules/**\n      - .serverless\n      - .env\n    events:\n      - apigw:\n          name: serverless\n          parameters:\n            protocols:\n              - http\n            serviceName: serverless\n            description: the serverless service\n            environment: release\n            endpoints:\n              - path: /test\n                method: ANY`, `88190034309663570000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Hello_World:\n  component: &quot;@serverless/tencent-scf&quot;\n  inputs:\n    name: Hello_World\n    codeUri: ./\n    handler: index.main_handler\n    runtime: Python3.6\n    region: ap-guangzhou\n    description: My Serverless Function\n    memorySize: 64\n    timeout: 20\n    exclude:\n      - .gitignore\n      - .git/**\n      - node_modules/**\n      - .serverless\n      - .env\n    events:\n      - apigw:\n          name: serverless\n          parameters:\n            protocols:\n              - http\n            serviceName: serverless\n            description: the serverless service\n            environment: release\n            endpoints:\n              - path: /test\n                method: ANY</code></pre></div>\n<p>通过 <code class=\"language-text\">sls --debug</code> 部署：</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"27395257134380070000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`DEBUG ─ Deployed function Hello_World successful\n\n  Hello_World:\n    Name:        Hello_World\n    Runtime:     Python3.6\n    Handler:     index.main_handler\n    MemorySize:  64\n    Timeout:     20\n    Region:      ap-guangzhou\n    Namespace:   default\n    Description: My Serverless Function\n    APIGateway:\n      - serverless - http://service-89bjzrye-1256773370.gz.apigw.tencentcs.com/release\n\n  30s › Hello_World › done`, `27395257134380070000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">DEBUG ─ Deployed function Hello_World successful\n\n  Hello_World:\n    Name:        Hello_World\n    Runtime:     Python3.6\n    Handler:     index.main_handler\n    MemorySize:  64\n    Timeout:     20\n    Region:      ap-guangzhou\n    Namespace:   default\n    Description: My Serverless Function\n    APIGateway:\n      - serverless - http://service-89bjzrye-1256773370.gz.apigw.tencentcs.com/release\n\n  30s › Hello_World › done</code></pre></div>\n<p>此时，我们配置了APIGW的触发器，地址是上面输出的地址 + endpoints中的path例如：</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"3643094161997440000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`http://service-89bjzrye-1256773370.gz.apigw.tencentcs.com/release/test`, `3643094161997440000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">http://service-89bjzrye-1256773370.gz.apigw.tencentcs.com/release/test</code></pre></div>\n<p>此时，我们可以打开实时日志：</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"16552885114172678000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`scflog logs -n Hello_World -r ap-guangzhou`, `16552885114172678000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">scflog logs -n Hello_World -r ap-guangzhou</code></pre></div>\n<p>此时会提醒我们实时日志开启成功：</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"91897317849334730000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`DFOUNDERLIU-MB0:~ dfounderliu\\$ scflog logs -n Hello_World -r ap-guangzhou\n实时日志开启 ...`, `91897317849334730000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">DFOUNDERLIU-MB0:~ dfounderliu$ scflog logs -n Hello_World -r ap-guangzhou\n实时日志开启 ...</code></pre></div>\n<p>我们可以用浏览器通过刚才函数部署完成返回给我们的地址触发函数：</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"89120598066298540000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"代码复制成功\"\n              data-toaster-duration=\"3500\"\n              onClick=\"copyToClipboard(`实时日志开启 ...\n[2020-03-04 16:36:08] :  ......}\n[2020-03-04 16:36:09] :  DEBUG debug_msg\n[2020-03-04 16:36:10] :  INFO info_msg\n[2020-03-04 16:36:11] :  WARNING warning_msg\n[2020-03-04 16:36:14] :  ERROR error_msg\n[2020-03-04 16:36:14] :  CRITICAL critical_msg\n[2020-03-04 16:36:16] :  context is: .......}\n.......`, `89120598066298540000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                复制代码<svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">实时日志开启 ...\n[2020-03-04 16:36:08] :  ......}\n[2020-03-04 16:36:09] :  DEBUG debug_msg\n[2020-03-04 16:36:10] :  INFO info_msg\n[2020-03-04 16:36:11] :  WARNING warning_msg\n[2020-03-04 16:36:14] :  ERROR error_msg\n[2020-03-04 16:36:14] :  CRITICAL critical_msg\n[2020-03-04 16:36:16] :  context is: .......}\n.......</code></pre></div>\n<p>至此，实现实时日志功能。</p>\n<h2 id=\"总结\"><a href=\"#%E6%80%BB%E7%BB%93\" aria-label=\"总结 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>总结</h2>\n<p>至此，完成了 Python 语言的实时日志功能，根据测试来看，性能还算不错，也还算稳定。通过 3 个函数 + APIGW + COS + CAM 完成了一个实时日志功能，理论上也可以复用到 Nodejs 等 Runtime。</p>\n<hr>\n<div id='scf-deploy-iframe-or-md'></div>\n<hr>\n<blockquote>\n<p><strong>传送门：</strong></p>\n<ul>\n<li>GitHub: <a href=\"https://github.com/serverless/serverless/blob/master/README_CN.md\">github.com/serverless</a></li>\n<li>官网：<a href=\"https://serverless.com/\">serverless.com</a></li>\n</ul>\n</blockquote>\n<p>欢迎访问：<a href=\"https://serverlesscloud.cn/\">Serverless 中文网</a>，您可以在 <a href=\"https://serverlesscloud.cn/best-practice\">最佳实践</a> 里体验更多关于 Serverless 应用的开发！</p>","tableOfContents":"<ul>\n<li><a href=\"/blog/2020-04-13-time-log/#%E5%BC%80%E5%8F%91%E5%89%8D%E8%A8%80\">开发前言</a></li>\n<li>\n<p><a href=\"/blog/2020-04-13-time-log/#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95%E6%95%99%E7%A8%8B%EF%BC%9A\">使用方法教程：</a></p>\n<ul>\n<li><a href=\"/blog/2020-04-13-time-log/#%E8%AF%B4%E6%98%8E\">说明</a></li>\n<li><a href=\"/blog/2020-04-13-time-log/#%E5%87%86%E5%A4%87\">准备</a></li>\n<li><a href=\"/blog/2020-04-13-time-log/#%E7%BB%84%E4%BB%B6%E9%83%A8%E7%BD%B2\">组件部署</a></li>\n<li><a href=\"/blog/2020-04-13-time-log/#%E9%A1%B9%E7%9B%AE%E4%B8%AD%E4%BD%BF%E7%94%A8\">项目中使用</a></li>\n</ul>\n</li>\n<li><a href=\"/blog/2020-04-13-time-log/#%E6%80%BB%E7%BB%93\">总结</a></li>\n</ul>"},"previousBlog":{"id":"e218778b-22f8-5931-8475-c0ad8a0165ed","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020523/1590205117399-16201.jpg","authors":["XaDon"],"categories":["user-stories"],"date":"2020-04-13T00:00:00.000Z","title":"在云函数 SCF 里为 Next.js 跑 SSR","description":"很多时候我们都希望首屏速度快，SEO 友好，那么相比于客户端渲染，SSR 渲染将是这方面的优势。","authorslink":["https://cloud.tencent.com/developer/article/1612986"],"translators":null,"translatorslink":null,"tags":["云函数","Serverless SSR"],"keywords":"Serverless,Serverless SSR,Serverless应用","outdated":null},"wordCount":{"words":130,"sentences":49,"paragraphs":49},"fileAbsolutePath":"/opt/build/repo/content/blog/2020-04-13-serverless-next.js-ssr.md","fields":{"slug":"/blog/2020-04-13-serverless-next.js-ssr/","keywords":["java","next.js","node.js","nodejs","serverless","客户端渲染","云函数","serverless","serverlesscloud","初始化","根目录"]}},"nextBlog":{"id":"79bc5567-9ccc-59eb-a458-e9739df4471e","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020523/1590214222379-%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_159021417080.png","authors":["乂乂又又"],"categories":["user-stories"],"date":"2020-04-13T00:00:00.000Z","title":"万物皆可 Serverless 之借助微信公众号简单管理用户激活码","description":"本文尝试带大家使用无服务器云函数和对象存储，快速编写上线自己的用户激活码后端管理云函数，然后把自己的微信公众号后台做为应用前台，简单管理用户激活码。","authorslink":["https://cloud.tencent.com/developer/article/1618586"],"translators":null,"translatorslink":null,"tags":["Serverless","微信公众号"],"keywords":"Serverless,Serverless python,Serverless应用","outdated":null},"wordCount":{"words":102,"sentences":24,"paragraphs":24},"fileAbsolutePath":"/opt/build/repo/content/blog/2020-04-13-serverless-scf-wechat.md","fields":{"slug":"/blog/2020-04-13-serverless-scf-wechat/","keywords":["java","python","serverless","云函数","reply","vipMap","cos","激活码","requestParameters"]}},"recommendBlogs":{"edges":[{"node":{"id":"665f9ce2-4451-59fd-bf98-1861789d3b3b","frontmatter":{"thumbnail":"https://s3-us-west-2.amazonaws.com/assets.blog.serverless.com/Serverless_logo.png","authors":["AndreaPasswater"],"categories":["guides-and-tutorials","engineering-culture"],"date":"2018-03-19T00:00:00.000Z","title":"如何为无服务器开放源代码项目做贡献","description":"想要为无服务器开放源代码项目做贡献？您可以遵循下面的指南。","authorslink":null,"translators":null,"translatorslink":null,"tags":null,"keywords":null,"outdated":null},"wordCount":{"words":96,"sentences":36,"paragraphs":36},"fileAbsolutePath":"/opt/build/repo/content/blog/2018-03-19-how-contribute-to-serverless-open-source.md","fields":{"slug":"/blog/2018-03-19-how-contribute-to-serverless-open-source/","keywords":["serverless","无服务器","serverless","github","插件","服务器","贡献","示例","blog","contribute"]}}},{"node":{"id":"a3e92579-65c3-5159-937c-32d18c5df7d7","frontmatter":{"thumbnail":"https://s3-us-west-2.amazonaws.com/assets.blog.serverless.com/why-not/why-not-header.png","authors":["AndreaPasswater"],"categories":["guides-and-tutorials","operations-and-observability","engineering-culture"],"date":"2018-03-21T00:00:00.000Z","title":"不适合选择无服务器的情境及原因","description":"无服务器既有优点也有缺点。那么，哪些情境下不适合选择无服务器？原因又是什么呢？","authorslink":null,"translators":null,"translatorslink":null,"tags":null,"keywords":null,"outdated":null},"wordCount":{"words":163,"sentences":43,"paragraphs":43},"fileAbsolutePath":"/opt/build/repo/content/blog/2018-03-21-when-why-not-use-serverless.md","fields":{"slug":"/blog/2018-03-21-when-why-not-use-serverless/","keywords":["faas","react","serverless","spa","无服务器","无服务器函数","无服务器架构","无服务器开发","服务器","twitter","serverless","blockquote","lang","script","en"]}}},{"node":{"id":"6a16520b-7886-582e-9182-64e50712d486","frontmatter":{"thumbnail":"https://s3-us-west-2.amazonaws.com/assets.blog.serverless.com/vendor+choice/serverless-data-portability.jpg","authors":["NickGottlieb"],"categories":["engineering-culture","guides-and-tutorials"],"date":"2018-06-20T00:00:00.000Z","title":"浅谈无服务器、数据锁定和供应商选择","description":"供应商选择是如今 IT 领导者需要考虑的最重要事项，而这一点可利用数据可移植性来实现。","authorslink":null,"translators":null,"translatorslink":null,"tags":null,"keywords":null,"outdated":null},"wordCount":{"words":205,"sentences":33,"paragraphs":33},"fileAbsolutePath":"/opt/build/repo/content/blog/2018-06-20-data-lockin-vendor-choice-portability.md","fields":{"slug":"/blog/2018-06-20-data-lockin-vendor-choice-portability/","keywords":["go","serverless","无服务器","无服务器架构","供应商","serverless","开发人员","数据","锁定","选择","服务"]}}},{"node":{"id":"94741abb-10ba-5db1-9756-cd1d573473fa","frontmatter":{"thumbnail":"https://s3-us-west-2.amazonaws.com/assets.blog.serverless.com/webstorm-ide/streamline-webstorm-serverless2.jpg","authors":["EslamHefnawy"],"categories":["guides-and-tutorials","engineering-culture"],"date":"2018-08-15T00:00:00.000Z","title":"如何使用 WebStorm 简化无服务器工作流程","description":"在本文中，我将和您分享如何使用 WebStorm 进行无服务器特定的 IDE 设置以及如何利用它来极大地加快无服务器工作流程。","authorslink":null,"translators":null,"translatorslink":null,"tags":null,"keywords":null,"outdated":null},"wordCount":{"words":234,"sentences":54,"paragraphs":54},"fileAbsolutePath":"/opt/build/repo/content/blog/2018-08-15-streamline-serverless-workflow-webstorm.md","fields":{"slug":"/blog/2018-08-15-streamline-serverless-workflow-webstorm/","keywords":["nodejs","serverless","无服务器","无服务器开发","serverless","WebStorm","webstorm","服务器","blog","assets"]}}},{"node":{"id":"713a0563-4bf9-5721-bacb-3b4ef609fe4a","frontmatter":{"thumbnail":"https://s3-us-west-2.amazonaws.com/assets.blog.serverless.com/camp-fire/camp-fire-housing-thumb.jpg","authors":["EricWyne"],"categories":["guides-and-tutorials","user-stories"],"date":"2018-12-05T00:00:00.000Z","title":"Serverless Twitter 机器人帮助为坎普山火受灾者安置住房","description":"加利福尼亚州的坎普山火致使数千人流离失所，为此，我构建了一个简单的 Serverless Twitter 机器人来帮助将受灾者安置在临时住房！","authorslink":["https://serverless.com/author/ericwyne/"],"translators":["Aceyclee"],"translatorslink":["zhihu.com/people/Aceyclee"],"tags":null,"keywords":null,"outdated":null},"wordCount":{"words":157,"sentences":26,"paragraphs":26},"fileAbsolutePath":"/opt/build/repo/content/blog/2018-12-05-serverless-twitter-camp-fire.md","fields":{"slug":"/blog/2018-12-05-serverless-twitter-camp-fire/","keywords":["serverless","无服务器","云函数","Serverless","org","住房","Twitter","函数","受灾","机器人","山火"]}}},{"node":{"id":"17c972d9-0583-51f6-9d5d-c2ba5f21b6a3","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/20191227/1577409288454-v2-577c2b21d600e3ea07f156f3e9d2d6b8_1200x500.jpg","authors":["Alfred Huang"],"categories":["guides-and-tutorials"],"date":"2019-08-21T00:00:00.000Z","title":"Serverless 的运行原理与组件架构","description":"本文重点探讨下开发者使用 Serverless 时经常遇到的一些问题，以及如何解决","authorslink":["https://zhuanlan.zhihu.com/ServerlessGo"],"translators":null,"translatorslink":null,"tags":["运行原理","serverless"],"keywords":"Serverless 运行原理,Serverless 组件架构","outdated":null},"wordCount":{"words":236,"sentences":33,"paragraphs":33},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-08-21-serverless-operation-architecture.md","fields":{"slug":"/blog/2019-08-21-serverless-operation-architecture/","keywords":["koa","serverless","云函数","Serverless","用户","函数","请求","实例","形态","业务","serverlesscloud"]}}},{"node":{"id":"ae4fd2f8-515c-5aec-b584-38427ef33f7e","frontmatter":{"thumbnail":"https://img.serverlesscloud.cn/2020114/1578989800047-part-00492-780.jpg","authors":["Anycodes"],"categories":["guides-and-tutorials","user-stories"],"date":"2019-09-16T00:00:00.000Z","title":"突破传统 OJ 瓶颈，「判题姬」接入云函数","description":"通过 Serverless 实现在线编程","authorslink":["https://www.zhihu.com/people/liuyu-43-97"],"translators":null,"translatorslink":null,"tags":["在线编程","云函数"],"keywords":"Serverless 在线编程,Serverless OJ","outdated":null},"wordCount":{"words":169,"sentences":30,"paragraphs":30},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-09-16-online-Judge.md","fields":{"slug":"/blog/2019-09-16-online-Judge/","keywords":["python","serverless","云函数","代码","函数","serverless"]}}},{"node":{"id":"545ab3d2-e14e-5cc2-8548-0e863eac942b","frontmatter":{"thumbnail":"https://s3-us-west-2.amazonaws.com/assets.blog.serverless.com/2019-10-deployment-best-practices/safeguard-header.png","authors":["FernandoMedinaCorey"],"categories":["guides-and-tutorials"],"date":"2019-10-14T00:00:00.000Z","title":"无服务器部署最佳实践","description":"了解部署无服务器应用时的一些最佳实践。","authorslink":null,"translators":null,"translatorslink":null,"tags":null,"keywords":null,"outdated":null},"wordCount":{"words":221,"sentences":46,"paragraphs":46},"fileAbsolutePath":"/opt/build/repo/content/blog/2019-10-14-serverless-deployment-best-practices.md","fields":{"slug":"/blog/2019-10-14-serverless-deployment-best-practices/","keywords":["serverless","无服务器","serverless","部署","服务器","开发人员","应用","安全措施","使用","函数"]}}}],"totalCount":31}},"pageContext":{"isCreatedByStatefulCreatePages":false,"blogId":"43f1b4b3-585f-5695-88a1-7611872268e3","previousBlogId":"e218778b-22f8-5931-8475-c0ad8a0165ed","nextBlogId":"79bc5567-9ccc-59eb-a458-e9739df4471e","categories":["guides-and-tutorials"]}}}