问题描述
当我尝试使用bunyan启动一个node.js应用程序时,一旦我尝试创建记录器,调试器停止。当我浏览代码时,我可以深入到createLogger中,找到它所在的位置。在node_modules / bunyan / lib中,调试器在第579行分离 -
When I try to launch a node.js app using bunyan, the debugger stops once I try to create the logger. When I step through the code, I can drill into createLogger and find where it breaks. In node_modules/bunyan/lib, the debugger detaches on line 579 -
assert.ok(isWritable(s.stream),
'"stream" stream is not writable: ' + util.inspect(s.stream));
调试器可以工作,直到我设置logger,之后它分离,我永远不会走到记录器。信息行。
The debugger works until I set logger, after that it detaches and I can never step to the logger.info line.
import bunyan from 'bunyan';
const logger = bunyan.createLogger({ name: 'test' }); //debugger detaches
logger.info('Hello logger'); // debugger will NOT step to this line
这不会发生在winston。我认为这与winston使用控制台和bunyan使用流有关。
This does not happen with winston. I think it has something to do with winston using console and bunyan using streams.
import winston from 'winston';
winston.info('Simple log');
const bp = 'The debugger will stop on me';
推荐答案
有同样的问题,但是通过更新到节点的最新版本(5.9.1)
Had the same issue, but resolved it by updating to the latest version of node(5.9.1)
这篇关于启动时使用bunyan.createLogger - Node v5.8进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!