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

Bunyan fails to log 'src' when running in Node 20 versus Node 18 #714

Open
a3957273 opened this issue Sep 2, 2023 · 0 comments · May be fixed by #715
Open

Bunyan fails to log 'src' when running in Node 20 versus Node 18 #714

a3957273 opened this issue Sep 2, 2023 · 0 comments · May be fixed by #715

Comments

@a3957273
Copy link

a3957273 commented Sep 2, 2023

Consider the following basic example of logging:

const bunyan = require("bunyan");

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

log.info("test");

When run in Node 18, this produces the expected result:

ubuntu:~/git/bunyan-src-bug$ nvm use 18
Now using node v18.17.1 (npm v9.6.7)
ubuntu:~/git/bunyan-src-bug$ node --version
v18.17.1
ubuntu@ip-10-0-142-245:~/git/bunyan-src-bug$ node index.js
{"name":"test","hostname":"redacted","pid":116506,"level":30,"msg":"test","time":"2023-09-02T22:45:14.794Z","src":{"file":"/home/ubuntu/git/bunyan-src-bug/index.js","line":8},"v":0}

However, when run in Node 20 it no longer logs a valid source:

ubuntu:~/git/bunyan-src-bug$ nvm use 20
Now using node v20.5.1 (npm v9.8.0)
ubuntu:~/git/bunyan-src-bug$ node --version
v20.5.1
ubuntu:~/git/bunyan-src-bug$ node index.js 
{"name":"test","hostname":"redacted","pid":116714,"level":30,"msg":"test","time":"2023-09-02T22:45:30.143Z","src":{},"v":0}

Note the empty object.

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 a pull request may close this issue.

1 participant