The logging appears to have changed a bit in V7.x.x with respect to the fastify server.
We are getting all the following logged on our production site (quite overwhelming and blowing up our logs):
INFO incoming request
INFO request completed
We’d like to have the fastify server logging at ‘warn’, but the rest of the app logging set to ‘info’. Looking at the latest createServer function in our server.ts, it has:
import { createServer } from '@redwoodjs/api-server'
import { logger } from 'src/lib/logger'
async function main() {
const server = await createServer({
logger,
})
await server.start()
}
main()
As it is passing in the main logger instance for the api side, does this mean we would need to create a separate logger instance to have different settings for the fastify server? Or am I missing something?
It seems if you’re using the server file, you could pass in two instances of logger.
In the example above, you’re re-using the same logger. Have you tried creating a different logger and passing to either createServer and createGraphqlHandler?
I’m extrapolating from the source in RW here, it should work in theory
That’s a simple enough solution, and I assume Logger is a fairly lightweight instance. We’ve implemented the code, and so far it appears to be behaving as expected.