I searched already asked questions and couldn't find any answers to this.
- Logging:
I want to log messages from hooks to see if it works as expected. I used the payload.logger.info in one of the hooks but it doesn't work. I am using the multi-tenant template. https://github.com/payloadcms/payload/tree/1.x/examples/multi-tenant
I tried to log in the src/fields/tenant/index.ts in the beforeChange hook like the following payload.logger.info('req.user>>', req.user) but it is not logged to the terminal. What am I missing here?
- Changing db connection on the fly.
How do I use the payload.db.create or payload.db.drizzle object to change a db connection based on the tenantId. For ex: if TenantId is 1, I want to open a connection to shard-1. The db I am using is postgres. I just want some examples on how to change connections to db on-the-fly programatically.