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)
- Custom format for ajv gets overwritten by ajv-formats HOT 4
- Plugin: Generate endpoints based on file names on a directory. HOT 16
- custom error handler not breaking encapsulation using fastify-plugin HOT 1
- Broken type inferrence with auxilliary hook handlers HOT 2
- listen() registers a callback even when listen() fails, calling the callback twice - once when it fails and again if it succeeds in a later call HOT 5
- Only automatically run workflows when a member approved them or if the PR is created by a member HOT 2
- app.close only triggers when a new request comes, resulting in 503 error HOT 7
- Missing cookie field in headers of upgrade websocket request HOT 2
- Custom bodyLimit is not taken into account, so fallback on default limit of 1MiB HOT 7
- Suggestion for Fastify 5: Required param to .send HOT 9
- Published packages contain unnecessary files HOT 3
- TypeScript error for FastifyOauth2 HOT 1
- Review on supporting schema shortened HOT 7
- Type Enhancement: Allow `FastifyPluginAsync` to return `void` (not only `Promise<void>`) HOT 2
- feat: add custom http methods HOT 1
- Migrate away from tap in all repositories HOT 5
- Empty `reply.request` in loggers.serializers.res HOT 3
- clarification on when `Reply` object is not fully constructed for `res` serializer
- Disable exposeHeadRoutes by default for fastify v5 HOT 9
- creating codemods for fastify upgrade v4 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.