FoalTS / foal

Full-featured Node.js framework 🚀
https://foalts.org/
MIT License
1.9k stars 141 forks source link

Add possibility to change default logger for express #967

Closed HRK44 closed 3 years ago

HRK44 commented 3 years ago

As of now, you are using morgan to log requests.

I want to know if it's possible to use an other logger, such as express-pino-logger, if not, would it be possible to select a custom logger instead of morgan ?

Thanks

LoicPoullain commented 3 years ago

You can disable morgan in the configuration with the key settings.loggerFormat:

{
  "settings": { "loggerFormat": "none" }
}

Then, I think you will be able to add your custom express-pino-logger middleware with this page: https://foalts.org/docs/cookbook/expressjs/#custom-express-instance

HRK44 commented 3 years ago

Ok thanks for your answer, I think it's doable this way.