How to format fastify logs as logfmt

252 views Asked by At

We have very strict rule: all microservices should write their logs using logfmt format. By default, fastify using json formatting. This is the only thing that stops us from using this framework.

I want fastify to write logs using logfmt formatting. Are there any ways to achieve this?

1

There are 1 answers

0
Manuel Spigolon On BEST ANSWER

Fastify uses pino logger under the hood so you need a pino transport to have it: https://github.com/pinojs/pino/blob/master/docs/transports.md

If it misses, you may implement and then fastify will work consequently