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
Support for pino-http multi instance #1260
Conversation
Thanks for opening this PR. Is it possible to add extra tests for a new feature and some documentation on it? |
At the moment, I don't understand how or what tests to write for this. This PR is more of a fix to the issue #1254. This does not introduce new feature for this library, the changes is to support the new version of As stated above, pinojs/pino-http#263 introduces the Why only FastifyAdapter?Fastify by default can have request logging using pino, so the The same happens with Please let me know If I missed something |
What I see is extra logic added: let log = req.log;
if (!useExisting && (req.allLogs?.length ?? 0) > 0) {
log = req.allLogs[req.allLogs.length - 1];
} so here are 2 variants what could be:
Here you can see that added line is uncovered |
The uncovered line is 120. To be more specific it's the According to https://github.com/pinojs/pino-http/blob/master/logger.js#L158-L164 But this has if (!useExisting && req.allLogs) {
log = req.allLogs[req.allLogs.length - 1];
} And for using I think the uncovered line/condition can never be reached when using If you aren't happy with this, Sorry, I won't be able to extend the test to cover |
Thanks for clarification. Let's simplify then to make it 100% covered. I'll be happy with this 😀 |
Okay. I have pushed the new change. Thanks. |
published in |
Thanks a lot for actively maintaining this library |
Adding support for the newly added
pino-http
multi instance middleware support
in pinojs/pino-http#263As a result of the above feature,
pino-http@^8.3.0
no longer works withnestjs-pino
when using theFastifyAdapter
asFastify
by default sets thereq.log
withnoop
functions whendisableRequestLogging
is set tofalse
Fixes #1254