Issue
FastifyAdapter
logger is pretty helpful in logging all the incoming requests:
{"level":30,"time":1615660286373,"pid":4,"hostname":"6bc78f92-9bd6-4dfb-bd11-ae4c17a67f7c","reqId":19,"res":{"statusCode":304},"responseTime":6.005196988582611,"msg":"request completed"}
That’s how I used it in Fastify mode/adapter:
const app = await NestFactory.create<NestFastifyApplication>(
AppModule,
new FastifyAdapter({logger: true})
)
Is there something similar in Express mode/adapter? Ideally without writing custom logging logic. It looks like a pretty common feature after all.
I checked ExpressAdapter
source but it doesn’t seem to have "log" being mentioned at all.
Solution
I don’t think so. If you need this feature you should install the logger that fastify uses: pino, and pino-http to enable this yourself. Or just use nestjs-pino (which will do this for you)