question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make req.id configurable

See original GitHub issue

Now, req.id https://github.com/pinojs/pino-http/blob/master/logger.js#L86 is static, it would be great if id property will be configurable.

Thanks.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
batersoncommented, Apr 22, 2020

@mcollina I just realized that we don’t need to do any changes to the codebase. Users can just use the custom serializers if they want to change the shape of the req object.

@akaNightmare try this approach

const pino = require('pino-http')

const reqSerialier = (req) =>  {
    const { id, ...serializedReq } = serializers.req(req)
    return { ...serializedReq, customId: id }
}

const logger = pino({
    serializers: {
       'req': reqSerialier
}})

@Kampfmoehre I don’t think it’s reasonable, you can always add your own Id along with the log message.

@mcollina what do you say? The issue could be closed?

0reactions
mcollinacommented, Apr 22, 2020

Yes, it can be closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Requisition and openings - Greenhouse Support
Requisition and Openings Overview; Req ID vs Opening ID ... This configuration applies to all of the openings you create for a job....
Read more >
Generate and log unique request ID in Express.js — Part 1
set the ID into the request-id header of the res object (header name is configurable); if configured, set the ID in the http...
Read more >
Creating a New Job or Requisition - iCIMS Community
The steps presented when creating a job are configurable, so your experience ... Tip: Within the Skills section of the Job profile or...
Read more >
How to automatically create multiple child requests from a ...
The configuration file has the name of the request template of the parent request and the list of child requests to be created....
Read more >
[#FLINK-12594] Make Job ID Configurable for a Job Cluster
It should be made configurable in the job cluster case. In the documentation for running a job cluster on Kubernetes, it's mentioned that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found