Skip to content

Instantly share code, notes, and snippets.

@barkinet
Forked from primaryobjects/console.js
Created June 9, 2017 04:03
Show Gist options
  • Select an option

  • Save barkinet/893af18c2c15c65b19894065758f161b to your computer and use it in GitHub Desktop.

Select an option

Save barkinet/893af18c2c15c65b19894065758f161b to your computer and use it in GitHub Desktop.
Overwrites console.log to send messages to a server.
(function(){
var oldLog = console.log;
console.log = function (message) {
// DO MESSAGE HERE.
alert('hi!');
oldLog.apply(console, arguments);
};
})();
  1. Paste the above code into the Chrome inspector.
  2. At the Chrome inspector console prompt, type:
console.log('hi');
  1. The result will be an alert message and console.log message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment