TLDR:
- If you want to log an object, 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.
- (As a result, I don't know how to log an error and also an object for context, but it might be possible.)
- But beware: If the "object" you are logging is actually a string, then do not put it as the first variable, concatenate it instead.
Patterns which are WORKING:
// Logging one string
fastify.log.info("message")