Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instantiating the Error class to call prepareStackTrace #715

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danilobatistaqueiroz
Copy link

@danilobatistaqueiroz danilobatistaqueiroz commented Sep 18, 2023

Using src:true isn't work in new Node versions.

const log = bunyan.createLogger({
  name: "test",
  src: true,
});

Fixes: #714

As of Node 20.1.0 if you don't call new Error() the method prepareStackTrace isn't called.

Nodejs issue: nodejs/node#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.

@ide
Copy link

ide commented Nov 17, 2023

Hi @trentm - would it be possible to get this reviewed and published?

@trentm
Copy link
Owner

trentm commented Nov 18, 2023

Looking.

@kaushals-deck
Copy link

Hi @trentm any update on the same...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bunyan fails to log 'src' when running in Node 20 versus Node 18
4 participants