Free logger for cloudflare workers

I needed a logger for my Cloudflare worker. So I created one using LogDNA’s api (free or super cheap logging client).

It logs a bunch of default values from the request and allows you to add custom meta data to the logs which are searchable on LogDNA.

Have a look and let me know what you think

Screenshots below (with a bunch of custom meta added via the logger, like errorMessage, errorCode, output, endpoint):

And graphs you can make using the custom meta data from the logger:

Example usage:

const logDnaLogger = require('./Logger')

addEventListener('fetch', event => {

 * Handle the request
 * @param request
 * @returns {Promise<Response>}
async function handleRequest(request) {    
    const logger = new logDnaLogger(request)
    try {
        logger.setMeta('day', 'Monday')'Request received')
        throw new Error('Something went wrong')
    } catch (e) {
    } finally {
      await logger.postRequest()