node-bunyan
node-bunyan copied to clipboard
Instantiating the Error class to call prepareStackTrace
Using src:true isn't work in new Node versions.
const log = bunyan.createLogger({
name: "test",
src: true,
});
Fixes: https://github.com/trentm/node-bunyan/issues/714
As of Node 20.1.0 if you don't call new Error()
the method prepareStackTrace
isn't called.
Nodejs issue: https://github.com/nodejs/node/issues/49681
Before the correction, using a Node version starting from 20.1.0, log.info returns an empty src.
//index.js
const bunyan = require("bunyan");
const log = bunyan.createLogger({name: "test", src: true});
log.info("test");
$ nvm use 18
$ node index.js
$ nvm use 20.5.0
$ node index.js
TESTS
There is a test for src named: src.test.js
and using node version 20.1.0 or latter it breaks at line 45.
Hi @trentm - would it be possible to get this reviewed and published?
Looking.
Hi @trentm any update on the same...