Fastify logging works differently from console.log()
. It has a few gotchas.
- If you want to log an object, then put the object as the first argument, and (optionally) a message string as the second argument.
- If you want to log an error object, it must be the first argument, and not a property inside an object.
- But beware: If the "object" you are logging is actually a string, then do not put it as the first variable, concatenate it instead.