For hackers: window.onerror = function(m, f, l){ var err = JSON.encode({ message:m, file:f, line:l }) (new Image).src = '/errors?e='+err } For Google Analytics users: window.onerror = function(m, f, l){ var err = [f, l, m].join(' : ') _gaq.push(['_trackEvent', 'Errors', 'App', err, null, true]) } Analytics will allow you to filter by OS, browser, and all the other environment data it already captures. And nice graphs…
Show HN: Proxino -- Monitor and Debug your JavaScript
31–40 of 49 posts
Re: Show HN: Proxino -- Monitor and Debug your JavaScript
#32Re: Show HN: Proxino -- Monitor and Debug your JavaScript
#33There are already services (like Sentry) that track errors well. I want a service that focuses on the non-error logging part. I typically develop my JS with a lot of console.log calls. Let's say a hundred at page load, and more for each user action, and when there's new data coming down from the server. I'm trying to fix a bug that my friend is having on my new project, but I can't reproduce it locally. I want to see…
Re: Show HN: Proxino -- Monitor and Debug your JavaScript
#34For hackers: window.onerror = function(m, f, l){ var err = JSON.encode({ message:m, file:f, line:l }) (new Image).src = '/errors?e='+err } For Google Analytics users: window.onerror = function(m, f, l){ var err = [f, l, m].join(' : ') _gaq.push(['_trackEvent', 'Errors', 'App', err, null, true]) } Analytics will allow you to filter by OS, browser, and all the other environment data it already captures. And nice graphs…
For some reason I thought they were doing more than this, like proxying your JavaScript (hence PROXino), instrumenting it with try/catches to provide robust stack traces, but apparently not: https://www.proxino.com/p.js
Re: Show HN: Proxino -- Monitor and Debug your JavaScript
#35For hackers: window.onerror = function(m, f, l){ var err = JSON.encode({ message:m, file:f, line:l }) (new Image).src = '/errors?e='+err } For Google Analytics users: window.onerror = function(m, f, l){ var err = [f, l, m].join(' : ') _gaq.push(['_trackEvent', 'Errors', 'App', err, null, true]) } Analytics will allow you to filter by OS, browser, and all the other environment data it already captures. And nice graphs…
Why wrap everything in json? Then you'll just have to decode it on the other end. Just use url parameters, it's what they are for: (new Image).src = '/errors?m='+encodeURIComponent(m)+ '&f='+encodeURIComponent(f)+'&l='+encodeURIComponent(l); This way it also works on browsers that don't have native JSON (old IE mainly, but also firefox before 3.5). And those are also exactly the browsers where you are likely to get e…
You don't need to encode the strings, the browser will do that for src.
Re: Show HN: Proxino -- Monitor and Debug your JavaScript
#36For hackers: window.onerror = function(m, f, l){ var err = JSON.encode({ message:m, file:f, line:l }) (new Image).src = '/errors?e='+err } For Google Analytics users: window.onerror = function(m, f, l){ var err = [f, l, m].join(' : ') _gaq.push(['_trackEvent', 'Errors', 'App', err, null, true]) } Analytics will allow you to filter by OS, browser, and all the other environment data it already captures. And nice graphs…
For some reason I thought they were doing more than this, like proxying your JavaScript (hence PROXino), instrumenting it with try/catches to provide robust stack traces, but apparently not: https://www.proxino.com/p.js
Re: Show HN: Proxino -- Monitor and Debug your JavaScript
#37Re: Show HN: Proxino -- Monitor and Debug your JavaScript
#38For hackers: window.onerror = function(m, f, l){ var err = JSON.encode({ message:m, file:f, line:l }) (new Image).src = '/errors?e='+err } For Google Analytics users: window.onerror = function(m, f, l){ var err = [f, l, m].join(' : ') _gaq.push(['_trackEvent', 'Errors', 'App', err, null, true]) } Analytics will allow you to filter by OS, browser, and all the other environment data it already captures. And nice graphs…
1. Set the window.onerror to immediately push errors to an array 2. Load a small unique script that will create a basic sendError function to post the onerror arguments to an endpoint with a unique csrf set. 3. Loop through the arguments that are queued up and send them to the endpoint. 4. Replace the window.onerror with the sendError function.
Your endpoint can be an API that will log the data to either something like Graylog2 or whatever your favorite logging system is. Not 100% bullet proof but better then nothing.
Re: Show HN: Proxino -- Monitor and Debug your JavaScript
#39There are already services (like Sentry) that track errors well. I want a service that focuses on the non-error logging part. I typically develop my JS with a lot of console.log calls. Let's say a hundred at page load, and more for each user action, and when there's new data coming down from the server. I'm trying to fix a bug that my friend is having on my new project, but I can't reproduce it locally. I want to see…
Re: Show HN: Proxino -- Monitor and Debug your JavaScript
#40There are already services (like Sentry) that track errors well. I want a service that focuses on the non-error logging part. I typically develop my JS with a lot of console.log calls. Let's say a hundred at page load, and more for each user action, and when there's new data coming down from the server. I'm trying to fix a bug that my friend is having on my new project, but I can't reproduce it locally. I want to see…
You should take a look at Weinre https://github.com/apache/incubator-cordova-weinre