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

Feature/#258 log error stack trace #264

Merged
merged 4 commits into from
Sep 20, 2017

Conversation

StarpTech
Copy link
Member

@StarpTech StarpTech commented Sep 20, 2017

fastify
  .get('/', schema, function (req, reply) {
    reply
      .send(Promise.reject(new Error('deded')))
  })

@mcollina
Copy link
Member

IMHO we can do the same thing by adding the standard error serializer, and not logging them in two lines.

Ideally the error  should be logged as err property, not error.

https://github.com/pinojs/pino/blob/master/docs/API.md#errSerializer

@allevo
Copy link
Member

allevo commented Sep 20, 2017

Hi,
you can configure pino to serialize errors. See here and here

The options used to create the pino instance is provided by fastify constructor. So you can do this right now!

Anyway, I agree with you: we need to figure out how the stack should be logged

@mcollina
Copy link
Member

Anyway, I agree with you: we need to figure out how the stack should be logged

pino-http added the err serializer but when we did #170 we forgot. That's the fix.

@mcollina mcollina added this to TODO in Roadmap to 1.0 Sep 20, 2017
@StarpTech
Copy link
Member Author

@mcollina did you mean this? I updated

lib/logger.js Outdated
}
}
return obj
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use pino.stdSerializers.err

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to use it but it creates a hard binding to the module.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mcollina mcollina merged commit b659b6d into fastify:master Sep 20, 2017
@mcollina mcollina moved this from TODO to DONE in Roadmap to 1.0 Sep 23, 2017
@StarpTech StarpTech deleted the feature/#258_log_error_stack_trace branch October 14, 2017 16:32
@github-actions
Copy link

This pull request 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 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants