{"repo":"samsonradu/console-subscriber","free":true,"listed":false,"github":"https://github.com/samsonradu/console-subscriber","clone":"git clone https://github.com/samsonradu/console-subscriber.git","description":"Subscribe to the browser's console output.","language":"JavaScript","stars":16,"topics":["browser","nodejs","logging","console","console-log"],"license":"MIT","category":"dev-tools","readme_excerpt":"Console subscriber A drop-in tool to subscribe to the console output. Useful for debugging JS scripts on a device where the console is not easily accessible like mobile device browsers, or even in Node environments. Installation npm script Usage let cs = require('console-subscriber'); // window.ConsoleSubscriber object is available in browsers / Function to be called on console output WARNING: calling console.log inside the callback would lead to an infinite recursion @param string $category info warn error debug @param array $args initial arguments of the call / let callback = (category, args) = { // In a browser env you could write to a DOM element let message = category + \": \" + JSON.stringify(args) + \"\\n\"; document.getElementById('console').innerHTML += message; // In a Node env you could store the console output (errors) if (category === \"error\"){ redisClient.sadd(\"console:error\", JSON.stringify(args)); } }; // Bind callback fn. Multiple functions can be bound. cs.bind(callback); // Unbind a previously bound callback cs.unbind(callback); // Restore defaults cs.unbind(); License MIT","default_branch":null,"files":null,"tree":[],"storefront":"/r/samsonradu","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/samsonradu/console-subscriber/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}