Simple logging in development

In development I want to be able to do some logging, like:
logger.debug('Fetching customer with id=%s', id);
logger.trace('Querying database for customer with id=%s', id);

by default it's fine to have just debug, but sometimes I would also like to trace logs for more details.

Besides the log message itself, I would like to log also automatically some context info, like the Hono request-id.

I tried Pino js logger, but it gives some problems on Cloudflare workers,
so I wonder if there are other (simple) solutions, or that I can better write my own?
Was this page helpful?