Bunyan fails to log 'src' when running in Node 20 versus Node 18
a3957273 opened this issue · 0 comments
a3957273 commented
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.