Comments (9)
ahem I'm one of those guys :)
I'd just check to see if the passed in option is a function and then pass it through to pino-http
appropriately.
I'll submit a PR after work.
from fastify.
The logger option purpose is not intended for setting a custom logger, but for pass some options to the internal pino-http
instance.
Have a look here and here :)
from fastify.
Probably you can try with:
const log = require('pino')()
const fastify = require('fastify')({
logger: {
logger: log
}
})
from fastify.
Then I think it should support passing in a custom logger. I didn't include it in the example, but I would further use req.log
in request handlers. This means I only have to configure one logger to use it in both manners: regular logs and request logs.
from fastify.
The {logger: {logger: log}}
is ugly, but it works.
from fastify.
Yeah, I agree.
I would like to ask to the 'pino guy' @mcollina: any idea on how design a nicer api?
from fastify.
Ops! Sorry :P
Anyway, PR are welcome!
from fastify.
thanks @jsumners!!
from fastify.
from fastify.
Related Issues (20)
- 'type' parameter name gives error in schema.querystring Routes options HOT 2
- Type narrow on status().send() chains using Type-Providers schema HOT 5
- `fastify.log.isLevelEnabled()` is missing from TypeScript types HOT 4
- Should send error response from a errorHandler without executing request lifecycle HOT 3
- docs: update the HTTPS server tutorial link of the section regarding TypeScript HOT 5
- Route schema might be undefined HOT 4
- Wrong DecorationMethod type
- Should "disableRequestLogging" suppress aborted requests? HOT 2
- `addContentTypeParser` doesn't work well after `await register` HOT 5
- Upload file always raises error FST_ERR_CTP_INVALID_CONTENT_LENGTH HOT 2
- Using fastify with Phusion Passenger fails with EADDRINUSE HOT 1
- How can I automatically restart my Fastify app in case of unhandled exceptions to ensure continuous server uptime in production? HOT 5
- `disableRequestLogging` should disable logs in default error handler HOT 6
- incorrect plugin identified for timeout HOT 1
- Backport webdav methods from next to current branch HOT 7
- OPTIONS HTTP method body processing HOT 3
- Dependency update for v5 HOT 1
- Merge main into next HOT 4
- Scoped FastifyRequest Customization via Generic Parameter in FastifyInstance HOT 1
- Flaky test on N|Solid 20 MacOS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastify.