Giter Site home page Giter Site logo

Comments (9)

jsumners avatar jsumners commented on May 9, 2024 2

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.

delvedor avatar delvedor commented on May 9, 2024

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.

delvedor avatar delvedor commented on May 9, 2024

Probably you can try with:

const log = require('pino')()
const fastify = require('fastify')({
  logger: {
    logger: log
  }
})

pino-http options

from fastify.

jsumners avatar jsumners commented on May 9, 2024

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.

jsumners avatar jsumners commented on May 9, 2024

The {logger: {logger: log}} is ugly, but it works.

from fastify.

delvedor avatar delvedor commented on May 9, 2024

Yeah, I agree.
I would like to ask to the 'pino guy' @mcollina: any idea on how design a nicer api?

from fastify.

delvedor avatar delvedor commented on May 9, 2024

Ops! Sorry :P

Anyway, PR are welcome!

from fastify.

mcollina avatar mcollina commented on May 9, 2024

thanks @jsumners!!

from fastify.

delvedor avatar delvedor commented on May 9, 2024

#52

from fastify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.