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

prettyPrint does not print child object e.g. x-request-id #1043

Closed
chetnawarade opened this issue Jun 16, 2021 · 4 comments
Closed

prettyPrint does not print child object e.g. x-request-id #1043

chetnawarade opened this issue Jun 16, 2021 · 4 comments

Comments

@chetnawarade
Copy link

ERROR [1623809348111] (my-bar-logger/79874 on MBP-foo): "fake error"
Error: "fake error"
at Object. (/Users/foo/ss/my-bar/app/bar/tests/my-bar-rest-impl-learner-500-error-tests.js:13:42)
at Object.invoke (/Users/foo/ss/my-bar/node_modules/sinon/lib/sinon/behavior.js:165:35)
at functionStub (/Users/foo/ss/my-bar/node_modules/sinon/lib/sinon/stub.js:42:43)
at Function.invoke (/Users/foo/ss/my-bar/node_modules/sinon/lib/sinon/proxy-invoke.js:50:47)
at handlebarRequest (/Users/foo/ss/my-bar/node_modules/sinon/lib/sinon/proxy.js:285:26)
at getLearnerbar (/Users/foo/ss/my-bar/app/bar/my-bar-rest-impl.js:45:28)
at /Users/foo/ss/my-bar/node_modules/express-async-wrap/lib/index.js:15:14
at Layer.handle [as handle_request] (/Users/foo/ss/my-bar/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/foo/ss/my-bar/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/Users/foo/ss/my-bar/node_modules/express/lib/router/route.js:112:3)

with prettyPrint as false json contains x-request-id

{“level”:“error”,“time”:1623809549883,“pid”:80044,“hostname”:“MBP-foo,“name”:“my-bar-logger”,“x-request-id”:“dfc2e009-4309-4a24-b41b-c5183e23a0b2",“stack”:“Error: \“fake error\“\n at Object. (/Users/foo/ss/my-bar/app/bar/tests/my-bar-rest-impl-learner-500-error-tests.js:13:42)\n at Object.invoke (/Users/foo/ss/my-bar/node_modules/sinon/lib/sinon/behavior.js:165:35)\n at functionStub (/Users/foo/ss/my-bar/node_modules/sinon/lib/sinon/stub.js:42:43)\n at Function.invoke (/Users/foo/ss/my-bar/node_modules/sinon/lib/sinon/proxy-invoke.js:50:47)\n at handlebarRequest (/Users/foo/ss/my-bar/node_modules/sinon/lib/sinon/proxy.js:285:26)\n at getLearnerbar (/Users/foo/ss/my-bar/app/bar/my-bar-rest-impl.js:45:28)\n at /Users/foo/ss/my-bar/node_modules/express-async-wrap/lib/index.js:15:14\n at Layer.handle [as handle_request] (/Users/foo/ss/my-bar/node_modules/express/lib/router/layer.js:95:5)\n at next (/Users/foo/ss/my-bar/node_modules/express/lib/router/route.js:137:13)\n at Route.dispatch (/Users/foo/ss/my-bar/node_modules/express/lib/router/route.js:112:3)“,”type”:“Error”,“message”:“\”fake error\“”}

@chetnawarade chetnawarade changed the title prettyPrint does not print x-request-id prettyPrint does not print child object e.g. x-request-id Jun 16, 2021
@jsumners
Copy link
Member

What are we supposed to take away from this report? What is the data causing the error? What is the minimal reproduction case?

@chetnawarade
Copy link
Author

When prettyPrint options are set as below e.g. and a child is created e.g. logger.child('somekey': 'some value') this child object/property isn't printed out. Posted prettPrint and json (prettyPrint: false) stack in previous comment to compare where child is set as 'x-request-id' this can be anything, i called out somekeyin this comment. Thanks for looking at this.

const logger = pino({
  prettyPrint: { levelFirst: true,
  forceColor: true }
})

vs.

const logger = pino({
  prettyPrint: false
})

@jsumners
Copy link
Member

https://stackoverflow.com/help/minimal-reproducible-example

In short: please provide a short script than can be copied, pasted, and run by node index.js.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants