Console.watch: a remote console polyfill for Cloudflare Workers

console.watch is a remote console polyfill I built for Cloudflare Workers, to make debugging easier. It redirects all console.* calls to your browser in real-time.

To use it in your project, go to https://console.watch, copy the polyfill code (465 bytes), and paste it at the top of your worker code. It doesn’t do any fancy formatting like native console methods, but is a good way to inspect values in your production/staging workers.

10 Likes

Thanks for this. :grinning:

This is really nice, can you share the source for this so we can use it privately?

2 Likes

console.watch is now apart of the Logflare family :slight_smile:

@thomas4 will probably open source, but I need to get it on GCP first which will change a lof of things.

2 Likes

Nice! Keep us posted :slight_smile:

1 Like

Well turns out this thing was setup and deployed on AWS with Cloudformation so we’re keeping it there. I just open sourced it though, so if you’re on AWS you can easily change a couple things in the template.yaml and spin it up!

You’ll need to put it on a domain but hey, throw it behind Access :slight_smile:

edit: here is the repo

1 Like

Super! I’ll get right on it :smiley:

Thanks for sharing!

1 Like

Just signed up to logflare after watching console.watch, anyway to integrate this small polyfill code to push data directly to logflare? If not this would be super cool to have that.

1 Like

Definitely. And we should have that soon. The console api is a list of args of which each element can be any type. Logflare doesn’t currently support an array containing more than one type of data type as BigQuery doesn’t support that either. You won’t have to worry about that … Just trying to figure out the right ergonomics.

Hey @chasers does Logflare support this polyfill yet?

I’m still looking for a simple way to log and query my console.log’s in my workers.

No unfortunately not … I forget where I got blocked with this. I think maybe it was because console.log supports any number of args and they can be anything.

It’s easy to get stuff to Logflare though, you just make a wrapper function that POSTs to our ingest endpoint. Just make sure to do that in a waitUntil so that your worker doesn’t get blocked on the POST request.

Has anyone tested console.watch with redux-logger?