Is there a Node.js console.log length limit?

后端 未结 2 998
野性不改
野性不改 2021-02-14 17:03

Is there a limit the length of console.log output in Node.js? The following prints numbers up to 56462, then stops. This came up because we were returning datasets from MySQL

2条回答
  •  青春惊慌失措
    2021-02-14 17:35

    I would recommend using output to file when using node > 6.0

    const output = fs.createWriteStream('./stdout.log');
    const errorOutput = fs.createWriteStream('./stderr.log');
    // custom simple logger
    const logger = new Console(output, errorOutput);
    // use it like console
    var count = 5;
    logger.log('count: %d', count);
    // in stdout.log: count 5
    

提交回复
热议问题