adobe / helix-universal-logger

A logger to be used in universal serverless actions
Apache License 2.0
0 stars 10 forks source link

Edge Compute Compatibility? #66

Open trieloff opened 2 years ago

trieloff commented 2 years ago

Overview

How would we get Edge Compute compatibility? I'm adding compatibility with Fastly Compute@Edge and Cloudflare Workers to helix-deploy right now. The question is how to enable console.log.* easily in these environments.

Details

In Fastly, logging is as easy as:

/* global fastly */
const logger = fastly.getLogger('Coralogix');
logger.log(JSON.stringify(data));

In Cloudflare, we have to make a fetch request to the Coralogix API, but fetch is built-in.

We could create an @adobe/helix-universal-edge-logger package that is published alongside @adobe/helix-universal-logger and replaces it via Webpack magic in helix-deploy. I'm not sure if we should fork this project, or tweak the release script to patch it in place or create a monorepo like we do in helix-shared

Also, I'm not sure if we should do the same for @adobe/helix-log and create an @adobe/helix-edge-log package that replaces phin in the Coralogix logger with fetch or fastly.getLogger()

tripodsan commented 2 years ago

I would probably create the helix-universal-edge-logger that is optimized for the edge case (pun intended ;-) and remove all the helix-log dependency, which is highly node based.