#Simple logging in development

2 messages · Page 1 of 1 (latest)

orchid crypt
#

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?

hexed raptor
#

Hi Marcel,

Is this purely for development? What's missing in the standard logging features console.log / console.debug etc that you would want in a logging library? For production I've been using https://axiom.co with a tail worker that pushes regular old console log's into Axiom. For Pino, you need to make sure you're using the 'web' version and not the 'node' version, since the node version isn't fully compatible.