Logger for workers

One of the most important things when you base your code non Workers is to be able to easily and quickly troubleshoot issues.

Right now I’ve created a module that I use in all of my workers that basically takes all console.log/error/warning… output and then asynchronously sends it to logDNA at the end of each request.

This works, but:

  1. It is tedious, there’s a lot of boilerplate code everywhere
  2. If I use another vendor I’ll have to rewrite a some code and redeploy all my workers
  3. It’s not easy at all to do this in Pages or site-workers. I have to hack some code into worker.js which is a little cryptic file.

I wish there was one place to configure where all console output will go to.
It can even have a nice features to change log-level globally or per worker so when I troubleshoot things I can switch to debug or trace.

I believe this will save tons of code and time for most worker developers.