Debugging breaks on launch with bunyan.createLogge

2019-07-27 06:41发布

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));

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

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';

1条回答
太酷不给撩
2楼-- · 2019-07-27 07:10

Had the same issue, but resolved it by updating to the latest version of node(5.9.1)

查看更多
登录 后发表回答