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.
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
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.
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.
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.