【问题标题】:Node.JS Winston logging, Visual Studio Debug Console Not PrintNode.JS Winston 日志记录,Visual Studio 调试控制台不打印
【发布时间】:2017-08-07 05:32:02
【问题描述】:

winston 日志记录期间在 Visual Studio 代码的终端上作为“节点应用程序”运行时,会输出控制台日志。 但是,Visual Studio 的调试控制台选项卡不会打印控制台日志。 为什么?

enter image description here enter image description here

【问题讨论】:

  • console.log 仅在 controller.js 中打印,不会在服务器端打印
  • 内部级别没有显示原因 console.logprocess.stdout 的包装器,但 winston 是一个简单的程序,您需要专门配置它以写入输出。

标签: node.js


【解决方案1】:

下面是我的launch.json 关键是"outputCapture": "std",

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "outputCapture": "std", //key is this line
            "program": "${workspaceFolder}/bin/www"
        }
    ]
}

【讨论】:

  • 关于在调试模式下运行的测试有什么建议吗?
猜你喜欢
  • 2021-08-13
  • 2015-04-15
  • 1970-01-01
  • 2019-05-20
  • 2019-07-06
  • 1970-01-01
  • 2020-08-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多